diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2012-03-30 14:50:38 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-02 15:00:28 +0200 |
commit | dab87c74e23a05781e73d15181609b57ac1fe461 (patch) | |
tree | d4d2d74058831241ef77f913a05bd6668edf402d | |
parent | 29e305e92fb03e75b7af9ae6baed7e9fbf44dfe3 (diff) |
Removed qjson parser.
Now when we have a json parser as part of qtbase, there is no need for qjson
Change-Id: If8930dc3b1e60a1a57dd4f5946dd22ed9f27a629
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
72 files changed, 70 insertions, 2400 deletions
diff --git a/src/3rdparty/qjson/README b/src/3rdparty/qjson/README deleted file mode 100644 index 450e97ee..00000000 --- a/src/3rdparty/qjson/README +++ /dev/null @@ -1,18 +0,0 @@ -This is a Qt JSON Parser and serializer. - -The API is trivial: - QVariant Json::parse(jsonString) - QByteArray Json::stringize(QVariant) - -Compilation: - The code uses QLALR (in Qt respository. $QTDIR/util/qlalr). Just, - 'qlalr json.g' produces the parser 'jsonparser.cpp'. This generated file is - checked into the respository for convenience, so that the user does - not need to build qlalr. - -Using in external projects: - Just drop 3 files - src/json.cpp src/json.h src/jsonparser.cpp into your code. - Add json.cpp to SOURCES and you are good to go. jsonparser.cpp is included by - json.cpp so you should not add it to SOURCES. You may add json.h to HEADERS but - it's not necessary since it does not contains any mocable content. - diff --git a/src/3rdparty/qjson/TODO b/src/3rdparty/qjson/TODO deleted file mode 100644 index e41f2ebe..00000000 --- a/src/3rdparty/qjson/TODO +++ /dev/null @@ -1,2 +0,0 @@ -What's needed before MR -1. Docs diff --git a/src/3rdparty/qjson/benchmark/benchmark.pro b/src/3rdparty/qjson/benchmark/benchmark.pro deleted file mode 100644 index d1e6c6e0..00000000 --- a/src/3rdparty/qjson/benchmark/benchmark.pro +++ /dev/null @@ -1,6 +0,0 @@ -QT += testlib -QT -= gui - -include(../src/json.pri) - -SOURCES += main.cpp diff --git a/src/3rdparty/qjson/benchmark/main.cpp b/src/3rdparty/qjson/benchmark/main.cpp deleted file mode 100644 index af82c991..00000000 --- a/src/3rdparty/qjson/benchmark/main.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include <QtCore> -#include <QTest> - -#include "json.h" - -class tst_Json : public QObject -{ - Q_OBJECT -private slots: - void testByteArray(); - void testString(); - void testNumbers(); -}; - -void tst_Json::testNumbers() -{ - QFile file(QLatin1String("numbers.json")); - file.open(QFile::ReadOnly); - QByteArray ba = file.readAll(); - QString data = QString::fromLocal8Bit(ba.constData(), ba.size()); - - QBENCHMARK { - JsonReader reader; - if (!reader.parse(data)) { - qDebug() << "Failed to parse: " << reader.errorString(); - return; - } - QVariant result = reader.result(); - } -} - -void tst_Json::testString() -{ - QFile file(QLatin1String("test.json")); - file.open(QFile::ReadOnly); - QByteArray ba = file.readAll(); - QString data = QString::fromLocal8Bit(ba.constData(), ba.size()); - - QBENCHMARK { - JsonReader reader; - if (!reader.parse(data)) { - qDebug() << "Failed to parse: " << reader.errorString(); - return; - } - QVariant result = reader.result(); - } -} - -void tst_Json::testByteArray() -{ - QFile file(QLatin1String("test.json")); - file.open(QFile::ReadOnly); - QByteArray testJson = file.readAll(); - - QBENCHMARK { - JsonReader reader; - if (!reader.parse(testJson)) { - qDebug() << "Failed to parse: " << reader.errorString(); - return; - } - QVariant result = reader.result(); - } -} - -QTEST_MAIN(tst_Json) -#include "main.moc" diff --git a/src/3rdparty/qjson/benchmark/numbers.json b/src/3rdparty/qjson/benchmark/numbers.json deleted file mode 100644 index 469156a7..00000000 --- a/src/3rdparty/qjson/benchmark/numbers.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "integer": 1234567890, - "real": -9876.543210, - "e": 0.123456789e-12, - "E": 1.234567890E+34, - "": 23456789012E66, - "zero": 0, - "one": 1 - }, - [ - -1234567890, - -1234567890, - -1234567890, - 1234567890, - 1234567890, - 1234567890 - ] -] diff --git a/src/3rdparty/qjson/benchmark/test.json b/src/3rdparty/qjson/benchmark/test.json deleted file mode 100644 index 7c935fff..00000000 --- a/src/3rdparty/qjson/benchmark/test.json +++ /dev/null @@ -1,66 +0,0 @@ -[ - "JSON Test Pattern pass1", - {"object with 1 member":["array with 1 element"]}, - {}, - [], - -42, - true, - false, - null, - { - "integer": 1234567890, - "real": -9876.543210, - "e": 0.123456789e-12, - "E": 1.234567890E+34, - "": 23456789012E66, - "zero": 0, - "one": 1, - "space": " ", - "quote": "\"", - "backslash": "\\", - "controls": "\b\f\n\r\t", - "slash": "/ & \/", - "alpha": "abcdefghijklmnopqrstuvwxyz", - "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "digit": "0123456789", - "0123456789": "digit", - "special": "`1~!@#$%^&*()_+-={\':[,]}|;.</>?", - "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", - "true": true, - "false": false, - "null": null, - "array":[ ], - "object":{ }, - "address": "50 St. James Street", - "url": "http://www.JSON.org/", - "comment": "// /* <!-- --", - "# -- --> */": " ", - " s p a c e d " :[1,2 , 3 - -, - -4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7], - "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", - "quotes": "" \u0022 %22 0x22 034 "", - "\/\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?" : "A key can be any string" - }, - 0.5 ,98.6 -, -99.44 -, - -1066, -1e1, -0.1e1, -1e-1, -1e00, -2e+00, -2e-00, -"rosebud", -{"foo": "bar"}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}} -] - diff --git a/src/3rdparty/qjson/json.pro b/src/3rdparty/qjson/json.pro deleted file mode 100644 index ffb1ce99..00000000 --- a/src/3rdparty/qjson/json.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS = tests benchmark diff --git a/src/3rdparty/qjson/qjson.pri b/src/3rdparty/qjson/qjson.pri deleted file mode 100644 index 680b5818..00000000 --- a/src/3rdparty/qjson/qjson.pri +++ /dev/null @@ -1 +0,0 @@ -include(src/json.pri) diff --git a/src/3rdparty/qjson/src/json.cpp b/src/3rdparty/qjson/src/json.cpp deleted file mode 100644 index dba77799..00000000 --- a/src/3rdparty/qjson/src/json.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include "json.h" -#include "jsonparser.cpp" - -#include <QTextCodec> -#include <qnumeric.h> - -/*! - \class JsonReader - \internal - \reentrant - - \brief The JsonReader class provides a fast parser for reading - well-formed JSON into a QVariant. - - The parser converts JSON types into QVariant types. For example, JSON - arrays are translated into QVariantList and JSON objects are translated - into QVariantMap. For example, - \code - JsonReader reader; - if (reader.parse("{ \"id\": 123, \"company\": \"Nokia\", \"authors\": [\"Denis\",\"Ettrich\",\"Girish\"])) { - QVariant result = reader.result(); - QVariantMap map = result.toMap(); // the JSON object - qDebug() << map.count(); // 3 - qDebug() << map["id"].toInt(); // 123 - qDebug() << map["company"].toString(); // "Nokia" - QVariantList list = map["authors"].toList(); - qDebug() << list[1].toString(); // "Girish" - } else { - qDebug() << reader.errorString(); - } - \endcode - - As seen above, the reader converts the JSON into a QVariant with arbitrary nesting. - A complete listing of JSON to QVariant conversion is documented at parse(). - - JsonWriter can be used to convert a QVariant into JSON string. -*/ - -/*! - Constructs a JSON reader. - */ -JsonReader::JsonReader() -{ -} - -/*! - Destructor - */ -JsonReader::~JsonReader() -{ -} - -/*! - Parses the JSON \a ba as a QVariant. - - If the parse succeeds, this function returns true and the QVariant can - be accessed using result(). If the parse fails, this function returns - false and the error message can be accessed using errorMessage(). - - The encoding of \ba is auto-detected based on the pattern of nulls in the - initial 4 octets as described in "Section 3. Encoding" of RFC 2647. If an - encoding could not be auto-detected, this function assumes UTF-8. - - The conversion from JSON type into QVariant type is as listed below: - \table - \row - \li false - \li QVariant::Bool with the value false. - \row - \li true - \li QVariant::Bool with the value true. - \row - \li null - \li QVariant::Invalid i.e QVariant() - \row - \li object - \li QVariant::Map i.e QVariantMap - \row - \li array - \li QVariant::List i.e QVariantList - \row - \li string - \li QVariant::String i.e QString - \row - \li number - \li QVariant::Double or QVariant::LongLong. If the JSON number contains a '.' or 'e' - or 'E', QVariant::Double is used. - \endtable - - The byte array \ba may or may not contain a BOM. - */ -bool JsonReader::parse(const QByteArray &ba) -{ - int mib = 106; // utf-8 - - QTextCodec *codec = QTextCodec::codecForUtfText(ba, 0); // try BOM detection - if (!codec) { - if (ba.length() > 3) { // auto-detect - const char *data = ba.constData(); - if (data[0] != 0) { - if (data[1] != 0) - mib = 106; // utf-8 - else if (data[2] != 0) - mib = 1014; // utf16 le - else - mib = 1019; // utf32 le - } else if (data[1] != 0) - mib = 1013; // utf16 be - else - mib = 1018; // utf32 be - } - codec = QTextCodec::codecForMib(mib); - } - QString str = codec->toUnicode(ba); - return parse(str); -} - -/*! - Parses the JSON string \a str as a QVariant. - - If the parse succeeds, this function returns true and the QVariant can - be accessed using result(). If the parse fails, this function returns - false and the error message can be accessed using errorMessage(). - */ -bool JsonReader::parse(const QString &str) -{ - JsonLexer lexer(str); - JsonParser parser; - if (!parser.parse(&lexer)) { - m_errorString = parser.errorMessage(); - m_result = QVariant(); - return false; - } - m_errorString.clear(); - m_result = parser.result(); - return true; -} - -/*! - Returns the result of the last parse() call. - - If parse() failed, this function returns an invalid QVariant. - */ -QVariant JsonReader::result() const -{ - return m_result; -} - -/*! - Returns the error message for the last parse() call. - - If parse() succeeded, this functions return an empty string. The error message - should be used for debugging purposes only. - */ -QString JsonReader::errorString() const -{ - return m_errorString; -} - -/*! - \class JsonWriter - \internal - \reentrant - - \brief The JsonWriter class converts a QVariant into a JSON string. - - The writer converts specific supported types stored in a QVariant into JSON. - For example, - \code - QVariant v; - QVariantMap map; - map["id"] = 123; - map["company"] = "Nokia"; - QVariantList list; - list << "Denis" << "Ettrich" << "Girish"; - map["authors"] = list; - - JsonWriter writer; - QString json = writer.toString(v); - qDebug() << json; // {"authors": ["Denis", "Ettrich", "Girish"], "company": "Nokia", "id": 123 } - \endcode - - The list of QVariant types that the writer supports is listed in toString(). Note that - custom C++ types registered using Q_DECLARE_METATYPE are not supported. -*/ - -/*! - Creates a JsonWriter. - */ -JsonWriter::JsonWriter() - : m_autoFormatting(false), m_autoFormattingIndent(4, QLatin1Char(' ')) -{ -} - -/*! - Destructor. - */ -JsonWriter::~JsonWriter() -{ -} - -/*! - Enables auto formatting if \a enable is \c true, otherwise - disables it. - - When auto formatting is enabled, the writer automatically inserts - spaces and new lines to make the output more human readable. - - The default value is \c false. - */ -void JsonWriter::setAutoFormatting(bool enable) -{ - m_autoFormatting = enable; -} - -/*! - Returns \c true if auto formattting is enabled, otherwise \c false. - */ -bool JsonWriter::autoFormatting() const -{ - return m_autoFormatting; -} - -/*! - Sets the number of spaces or tabs used for indentation when - auto-formatting is enabled. Positive numbers indicate spaces, - negative numbers tabs. - - The default indentation is 4. - - \sa setAutoFormatting() -*/ -void JsonWriter::setAutoFormattingIndent(int spacesOrTabs) -{ - m_autoFormattingIndent = QString(qAbs(spacesOrTabs), QLatin1Char(spacesOrTabs >= 0 ? ' ' : '\t')); -} - -/*! - Retuns the numbers of spaces or tabs used for indentation when - auto-formatting is enabled. Positive numbers indicate spaces, - negative numbers tabs. - - The default indentation is 4. - - \sa setAutoFormatting() -*/ -int JsonWriter::autoFormattingIndent() const -{ - return m_autoFormattingIndent.count(QLatin1Char(' ')) - m_autoFormattingIndent.count(QLatin1Char('\t')); -} - -/*! \internal - Inserts escape character \ for characters in string as described in JSON specification. - */ -static QString escape(const QVariant &variant) -{ - QString str = variant.toString(); - QString res; - res.reserve(str.length()); - for (int i = 0; i < str.length(); i++) { - if (str[i] == QLatin1Char('\b')) { - res += QLatin1String("\\b"); - } else if (str[i] == QLatin1Char('\f')) { - res += QLatin1String("\\f"); - } else if (str[i] == QLatin1Char('\n')) { - res += QLatin1String("\\n"); - } else if (str[i] == QLatin1Char('\r')) { - res += QLatin1String("\\r"); - } else if (str[i] == QLatin1Char('\t')) { - res += QLatin1String("\\t"); - } else if (str[i] == QLatin1Char('\"')) { - res += QLatin1String("\\\""); - } else if (str[i] == QLatin1Char('\\')) { - res += QLatin1String("\\\\"); - } else if (str[i] == QLatin1Char('/')) { - res += QLatin1String("\\/"); - } else if (str[i].unicode() > 127) { - res += QLatin1String("\\u") + QString::number(str[i].unicode(), 16).rightJustified(4, QLatin1Char('0')); - } else { - res += str[i]; - } - } - return res; -} - -/*! \internal - Stringifies \a variant. - */ -QString JsonWriter::stringify(const QVariant &variant, int depth) -{ - QString result; - if (variant.type() == QVariant::List || variant.type() == QVariant::StringList) { - result += QLatin1Char('['); - QVariantList list = variant.toList(); - for (int i = 0; i < list.count(); i++) { - if (i != 0) { - result += QLatin1Char(','); - if (m_autoFormatting) - result += QLatin1Char(' '); - } - result += stringify(list[i], depth+1); - } - result += QLatin1Char(']'); - } else if (variant.type() == QVariant::Map) { - QString indent = m_autoFormattingIndent.repeated(depth); - QVariantMap map = variant.toMap(); - if (m_autoFormatting && depth != 0) { - result += QLatin1Char('\n'); - result += indent; - result += QLatin1String("{\n"); - } else { - result += QLatin1Char('{'); - } - for (QVariantMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) { - if (it != map.constBegin()) { - result += QLatin1Char(','); - if (m_autoFormatting) - result += QLatin1Char('\n'); - } - if (m_autoFormatting) - result += indent + QLatin1Char(' '); - result += QLatin1Char('\"') + escape(it.key()) + QLatin1String("\":"); - result += stringify(it.value(), depth+1); - } - if (m_autoFormatting) { - result += QLatin1Char('\n'); - result += indent; - } - result += QLatin1Char('}'); - } else if (variant.type() == QVariant::String || variant.type() == QVariant::ByteArray) { - result = QLatin1Char('\"') + escape(variant) + QLatin1Char('\"'); - } else if (variant.type() == QVariant::Double || (int)variant.type() == (int)QMetaType::Float) { - double d = variant.toDouble(); - if (qIsFinite(d)) - result.setNum(variant.toDouble(), 'g', 15); - else - result = QLatin1String("null"); - } else if (variant.type() == QVariant::Bool) { - result = variant.toBool() ? QLatin1String("true") : QLatin1String("false"); - } else if (variant.type() == QVariant::Invalid) { - result = QLatin1String("null"); - } else if (variant.type() == QVariant::ULongLong) { - result = QString::number(variant.toULongLong()); - } else if (variant.type() == QVariant::LongLong) { - result = QString::number(variant.toLongLong()); - } else if (variant.type() == QVariant::Int) { - result = QString::number(variant.toInt()); - } else if (variant.type() == QVariant::UInt) { - result = QString::number(variant.toUInt()); - } else if (variant.type() == QVariant::Char) { - QChar c = variant.toChar(); - if (c.unicode() > 127) - result = QLatin1String("\"\\u") + QString::number(c.unicode(), 16).rightJustified(4, QLatin1Char('0')) + QLatin1Char('\"'); - else - result = QLatin1Char('\"') + c + QLatin1Char('\"'); - } else if (variant.canConvert<qlonglong>()) { - result = QString::number(variant.toLongLong()); - } else if (variant.canConvert<QString>()) { - result = QLatin1Char('\"') + escape(variant) + QLatin1Char('\"'); - } else { - result = QLatin1String("null"); - } - - return result; -} - -/*! - Converts the variant \a var into a JSON string. - - The stringizer converts \a var into JSON based on the type of it's contents. The supported - types and their conversion into JSON is as listed below: - - \table - \row - \li QVariant::List, QVariant::StringList - \li JSON array [] - \row - \li QVariant::Map - \li JSON object {} - \row - \li QVariant::String, QVariant::ByteArray - \li JSON string encapsulated in double quotes. String contents are escaped using '\' if necessary. - \row - \li QVariant::Double, QMetaType::Float - \li JSON number with a precision 15. Infinity and NaN are converted into null. - \row - \li QVariant::Bool - \li JSON boolean true and false - \row - \li QVariant::Invalid - \li JSON null - \row - \li QVariant::ULongLong, QVariant::LongLong, QVariant::Int, QVariant::UInt, - \li JSON number - \row - \li QVariant::Char - \li JSON string. Non-ASCII characters are converted into the \uXXXX notation. - \endtable - - As a fallback, the writer attempts to convert a type not listed above into a long long or a - QString using QVariant::canConvert. See the QVariant documentation for possible conversions. - - JsonWriter does not support stringizing custom user types stored in the QVariant. Any such - value would be converted into JSON null. - */ -QString JsonWriter::toString(const QVariant &var) -{ - return stringify(var); -} - -/*! - Converts the variant \a var into a JSON string. - - The returned QByteArray is UTF-8 encoded and does not contain a BOM. The list of supported - C++ types is documented in toString(). - - \sa toString() - */ -QByteArray JsonWriter::toByteArray(const QVariant &var) -{ - return stringify(var).toUtf8(); -} - diff --git a/src/3rdparty/qjson/src/json.g b/src/3rdparty/qjson/src/json.g deleted file mode 100644 index d1f9e17f..00000000 --- a/src/3rdparty/qjson/src/json.g +++ /dev/null @@ -1,420 +0,0 @@ --- *************************************************************************** --- --- Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> --- Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> --- --- Use, modification and distribution is allowed without limitation, --- warranty, liability or support of any kind. --- --- ************************************************************************** - -%parser JsonGrammar -%merged_output jsonparser.cpp - -%token T_STRING "string" -%token T_NUMBER "number" -%token T_LCURLYBRACKET "{" -%token T_RCURLYBRACKET "}" -%token T_LSQUAREBRACKET "[" -%token T_RSQUAREBRACKET "]" -%token T_COLON ":" -%token T_COMMA "," -%token T_FALSE "false" -%token T_TRUE "true" -%token T_NULL "null" -%token ERROR "error" - -%start Root - -/: -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#ifndef JSONPARSER_P_H -#define JSONPARSER_P_H - -#include <QString> -#include <QVariant> -#include <QVector> - -class JsonLexer -{ -public: - JsonLexer(const QString &string); - ~JsonLexer(); - - int lex(); - QVariant symbol() const { return m_symbol; } - int lineNumber() const { return m_lineNumber; } - int pos() const { return m_pos; } - -private: - int parseNumber(); - int parseString(); - int parseKeyword(); - - QString m_strdata; - int m_lineNumber; - int m_pos; - QVariant m_symbol; -}; - -class JsonParser : protected $table -{ -public: - JsonParser(); - ~JsonParser(); - - bool parse(JsonLexer *lex); - QVariant result() const { return m_result; } - QString errorMessage() const { return QString::fromLatin1("%1 at line %2 pos %3").arg(m_errorMessage).arg(m_errorLineNumber).arg(m_errorPos); } - -private: - void reallocateStack(); - - inline QVariant &sym(int index) - { return m_symStack[m_tos + index - 1]; } - inline QVariantMap &map(int index) - { return m_mapStack[m_tos + index - 1]; } - inline QVariantList &list(int index) - { return m_listStack[m_tos + index - 1]; } - - int m_tos; - QVector<int> m_stateStack; - QVector<QVariant> m_symStack; - QVector<QVariantMap> m_mapStack; - QVector<QVariantList> m_listStack; - QString m_errorMessage; - int m_errorLineNumber; - int m_errorPos; - QVariant m_result; -}; - -#endif // JSONPARSER_P_H -:/ - -/. -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include <QtDebug> - -#define L1C(c) ushort(uchar(c)) - -JsonLexer::JsonLexer(const QString &str) - : m_strdata(str), m_lineNumber(1), m_pos(0) -{ -} - - - -JsonLexer::~JsonLexer() -{ -} - -int JsonLexer::parseString() -{ - bool esc = false; - ++m_pos; // skip initial " - int start = m_pos; - - const ushort *uc = m_strdata.utf16(); - const int remaining = m_strdata.length() - m_pos; - int i; - for (i = 0; i < remaining; ++i) { - const ushort c = uc[m_pos + i]; - if (c == L1C('\"')) { - m_symbol = QString((QChar *)uc + m_pos, i); - m_pos += i; - ++m_pos; // eat quote - return JsonGrammar::T_STRING; - } else if (c == L1C('\\')) { - ++m_pos; // eat backslash - esc = true; - break; - } - } - - QString str; - if (i) { - str.resize(i); - memcpy((char *)str.utf16(), uc + start, i * 2); - m_pos += i; - } - - for (; m_pos < m_strdata.length(); ++m_pos) { - const ushort c = uc[m_pos]; - if (esc) { - if (c == L1C('b')) str += QLatin1Char('\b'); - else if (c == L1C('f')) str += QLatin1Char('\f'); - else if (c == L1C('n')) str += QLatin1Char('\n'); - else if (c == L1C('r')) str += QLatin1Char('\r'); - else if (c == L1C('t')) str += QLatin1Char('\t'); - else if (c == L1C('\\')) str += QLatin1Char('\\'); - else if (c == L1C('\"')) str += QLatin1Char('\"'); - else if (c == L1C('u') && m_pos+4<m_strdata.length()-1) { - QString u = m_strdata.mid(m_pos+1, 4); - str += QChar(u.toUShort(0, 16)); - m_pos += 4; - } else { - str += QChar(c); - } - esc = false; - } else if (c == L1C('\\')) { - esc = true; - } else if (c == L1C('\"')) { - m_symbol = str; - ++m_pos; - return JsonGrammar::T_STRING; - } else { - str += QChar(c); - } - } - return JsonGrammar::ERROR; -} - -int JsonLexer::parseNumber() -{ - int start = m_pos; - bool isDouble = false; - const ushort *uc = m_strdata.utf16(); - const int l = m_strdata.length(); - const int negative = (uc[m_pos] == L1C('-') ? ++m_pos, -1 : (uc[m_pos] == L1C('+') ? ++m_pos, 1 : 1)); - qlonglong value = 0; - for (; m_pos < l; ++m_pos) { - const ushort &c = uc[m_pos]; - if (c == L1C('+') || c == L1C('-')) - continue; - if (c == L1C('.') || c == L1C('e') || c == L1C('E')) { - isDouble = true; - continue; - } - if (c >= L1C('0') && c <= L1C('9')) { - if (!isDouble) { - value *= 10; - value += c - L1C('0'); - } - continue; - } - break; - } - if (!isDouble) { - m_symbol = value * negative; - } else { - QString number = QString::fromRawData((QChar *)uc+start, m_pos-start); - m_symbol = number.toDouble(); - } - return JsonGrammar::T_NUMBER; -} - -int JsonLexer::parseKeyword() -{ - int start = m_pos; - for (; m_pos < m_strdata.length(); ++m_pos) { - const ushort c = m_strdata.at(m_pos).unicode(); - if (c >= L1C('a') && c <= L1C('z')) - continue; - break; - } - const ushort *k = (const ushort *)m_strdata.constData() + start; - const int l = m_pos-start; - if (l == 4) { - static const ushort true_data[] = { 't', 'r', 'u', 'e' }; - static const ushort null_data[] = { 'n', 'u', 'l', 'l' }; - if (!memcmp(k, true_data, 4)) - return JsonGrammar::T_TRUE; - if (!memcmp(k, null_data, 4)) - return JsonGrammar::T_NULL; - } else if (l == 5) { - static const ushort false_data[] = { 'f', 'a', 'l', 's', 'e' }; - if (!memcmp(k, false_data, 5)) - return JsonGrammar::T_FALSE; - } - return JsonGrammar::ERROR; -} - -int JsonLexer::lex() -{ - m_symbol.clear(); - - const ushort *uc = m_strdata.utf16(); - const int len = m_strdata.length(); - while (m_pos < len) { - const ushort c = uc[m_pos]; - switch (c) { - case L1C('['): ++m_pos; return JsonGrammar::T_LSQUAREBRACKET; - case L1C(']'): ++m_pos; return JsonGrammar::T_RSQUAREBRACKET; - case L1C('{'): ++m_pos; return JsonGrammar::T_LCURLYBRACKET; - case L1C('}'): ++m_pos; return JsonGrammar::T_RCURLYBRACKET; - case L1C(':'): ++m_pos; return JsonGrammar::T_COLON; - case L1C(','): ++m_pos; return JsonGrammar::T_COMMA; - case L1C(' '): case L1C('\r'): case L1C('\t'): ++m_pos; break; - case L1C('\n'): ++m_pos; ++m_lineNumber; break; - case L1C('"'): return parseString(); - default: - if (c == L1C('+') || c == L1C('-') || (c >= L1C('0') && c <= L1C('9'))) { - return parseNumber(); - } - if (c >= L1C('a') && c <= L1C('z')) { - return parseKeyword(); - } - return JsonGrammar::ERROR; - } - } - return JsonGrammar::EOF_SYMBOL; -} -#undef L1C - -JsonParser::JsonParser() -{ -} - -JsonParser::~JsonParser() -{ -} - -void JsonParser::reallocateStack() -{ - int size = m_stateStack.size(); - if (size == 0) - size = 128; - else - size <<= 1; - - m_symStack.resize(size); - m_mapStack.resize(size); - m_listStack.resize(size); - m_stateStack.resize(size); -} - -bool JsonParser::parse(JsonLexer *lexer) -{ - const int INITIAL_STATE = 0; - int yytoken = -1; - reallocateStack(); - m_tos = 0; - m_stateStack[++m_tos] = INITIAL_STATE; - - while (true) { - const int state = m_stateStack[m_tos]; - if (yytoken == -1 && -TERMINAL_COUNT != action_index[state]) { - yytoken = lexer->lex(); - } - int act = t_action(state, yytoken); - if (act == ACCEPT_STATE) - return true; - else if (act > 0) { - if (++m_tos == m_stateStack.size()) - reallocateStack(); - m_stateStack[m_tos] = act; - m_symStack[m_tos] = lexer->symbol(); - yytoken = -1; - } else if (act < 0) { - int r = -act-1; - m_tos -= rhs[r]; - act = m_stateStack.at(m_tos++); - switch (r) { -./ - -Root ::= Value; -/. case $rule_number: { m_result = sym(1); break; } ./ - -Object ::= T_LCURLYBRACKET Members T_RCURLYBRACKET; -/. case $rule_number: { sym(1) = map(2); break; } ./ - -Members ::= T_STRING T_COLON Value; -/. case $rule_number: { QVariantMap m; m.insert(sym(1).toString(), sym(3)); map(1) = m; break; } ./ - -Members ::= Members T_COMMA T_STRING T_COLON Value; -/. case $rule_number: { map(1).insert(sym(3).toString(), sym(5)); break; } ./ - -Members ::= ; -/. case $rule_number: { map(1) = QVariantMap(); break; } ./ - -Value ::= T_FALSE; -/. case $rule_number: { sym(1) = QVariant(false); break; } ./ - -Value ::= T_TRUE; -/. case $rule_number: { sym(1) = QVariant(true); break; } ./ - -Value ::= T_NULL; -Value ::= Object; -Value ::= Array; -Value ::= T_NUMBER; -Value ::= T_STRING; - -Array ::= T_LSQUAREBRACKET Values T_RSQUAREBRACKET; -/. case $rule_number: { sym(1) = list(2); break; } ./ - -Values ::= Value; -/. case $rule_number: { QVariantList l; l.append(sym(1)); list(1) = l; break; } ./ - -Values ::= Values T_COMMA Value; -/. case $rule_number: { list(1).append(sym(3)); break; } ./ - -Values ::= ; -/. case $rule_number: { list(1) = QVariantList(); break; } ./ - -/. - } // switch - m_stateStack[m_tos] = nt_action(act, lhs[r] - TERMINAL_COUNT); - } else { - int ers = state; - int shifts = 0; - int reduces = 0; - int expected_tokens[3]; - for (int tk = 0; tk < TERMINAL_COUNT; ++tk) { - int k = t_action(ers, tk); - - if (! k) - continue; - else if (k < 0) - ++reduces; - else if (spell[tk]) { - if (shifts < 3) - expected_tokens[shifts] = tk; - ++shifts; - } - } - - m_errorLineNumber = lexer->lineNumber(); - m_errorPos = lexer->pos(); - m_errorMessage.clear(); - if (shifts && shifts < 3) { - bool first = true; - - for (int s = 0; s < shifts; ++s) { - if (first) - m_errorMessage += QLatin1String("Expected "); - else - m_errorMessage += QLatin1String(", "); - - first = false; - m_errorMessage += QLatin1String("'"); - m_errorMessage += QLatin1String(spell[expected_tokens[s]]); - m_errorMessage += QLatin1String("'"); - } - } - return false; - } - } - - return false; -} - -./ - diff --git a/src/3rdparty/qjson/src/json.h b/src/3rdparty/qjson/src/json.h deleted file mode 100644 index 62f33a40..00000000 --- a/src/3rdparty/qjson/src/json.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#ifndef JSON_H -#define JSON_H - -#include <QByteArray> -#include <QVariant> - -class JsonReader -{ -public: - JsonReader(); - ~JsonReader(); - - bool parse(const QByteArray &ba); - bool parse(const QString &str); - - QVariant result() const; - - QString errorString() const; - -private: - QVariant m_result; - QString m_errorString; - void *reserved; -}; - -class JsonWriter -{ -public: - JsonWriter(); - ~JsonWriter(); - - QString toString(const QVariant &variant); - QByteArray toByteArray(const QVariant &variant); - - void setAutoFormatting(bool autoFormat); - bool autoFormatting() const; - - void setAutoFormattingIndent(int spaceOrTabs); - int autoFormattingIndent() const; - -private: - QString stringify(const QVariant &variant, int depth = 0); - bool m_autoFormatting; - QString m_autoFormattingIndent; - void *reserved; -}; - -#endif // JSON_H - diff --git a/src/3rdparty/qjson/src/json.pri b/src/3rdparty/qjson/src/json.pri deleted file mode 100644 index 0244a158..00000000 --- a/src/3rdparty/qjson/src/json.pri +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDEPATH += $$PWD -SOURCES += $$PWD/json.cpp - -#DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY diff --git a/src/3rdparty/qjson/src/jsonparser.cpp b/src/3rdparty/qjson/src/jsonparser.cpp deleted file mode 100644 index 899103f9..00000000 --- a/src/3rdparty/qjson/src/jsonparser.cpp +++ /dev/null @@ -1,527 +0,0 @@ -// This file was generated by qlalr - DO NOT EDIT! -#ifndef JSONPARSER_CPP -#define JSONPARSER_CPP - -class JsonGrammar -{ -public: - enum VariousConstants { - EOF_SYMBOL = 0, - ERROR = 12, - T_COLON = 7, - T_COMMA = 8, - T_FALSE = 9, - T_LCURLYBRACKET = 3, - T_LSQUAREBRACKET = 5, - T_NULL = 11, - T_NUMBER = 2, - T_RCURLYBRACKET = 4, - T_RSQUAREBRACKET = 6, - T_STRING = 1, - T_TRUE = 10, - - ACCEPT_STATE = 12, - RULE_COUNT = 17, - STATE_COUNT = 27, - TERMINAL_COUNT = 13, - NON_TERMINAL_COUNT = 7, - - GOTO_INDEX_OFFSET = 27, - GOTO_INFO_OFFSET = 37, - GOTO_CHECK_OFFSET = 37 - }; - - static const char *const spell []; - static const short lhs []; - static const short rhs []; - -#ifndef QLALR_NO_JSONGRAMMAR_DEBUG_INFO - static const int rule_index []; - static const int rule_info []; -#endif // QLALR_NO_JSONGRAMMAR_DEBUG_INFO - - static const short goto_default []; - static const short action_default []; - static const short action_index []; - static const short action_info []; - static const short action_check []; - - static inline int nt_action (int state, int nt) - { - const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; - if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) - return goto_default [nt]; - - return action_info [GOTO_INFO_OFFSET + yyn]; - } - - static inline int t_action (int state, int token) - { - const int yyn = action_index [state] + token; - - if (yyn < 0 || action_check [yyn] != token) - return - action_default [state]; - - return action_info [yyn]; - } -}; - - -const char *const JsonGrammar::spell [] = { - "end of file", "string", "number", "{", "}", "[", "]", ":", ",", "false", - "true", "null", "error", -#ifndef QLALR_NO_JSONGRAMMAR_DEBUG_INFO -"Root", "Value", "Object", "Members", "Array", "Values", "$accept" -#endif // QLALR_NO_JSONGRAMMAR_DEBUG_INFO -}; - -const short JsonGrammar::lhs [] = { - 13, 15, 16, 16, 16, 14, 14, 14, 14, 14, - 14, 14, 17, 18, 18, 18, 19}; - -const short JsonGrammar::rhs [] = { - 1, 3, 3, 5, 0, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 3, 0, 2}; - - -#ifndef QLALR_NO_JSONGRAMMAR_DEBUG_INFO -const int JsonGrammar::rule_info [] = { - 13, 14 - , 15, 3, 16, 4 - , 16, 1, 7, 14 - , 16, 16, 8, 1, 7, 14 - , 16 - , 14, 9 - , 14, 10 - , 14, 11 - , 14, 15 - , 14, 17 - , 14, 2 - , 14, 1 - , 17, 5, 18, 6 - , 18, 14 - , 18, 18, 8, 14 - , 18 - , 19, 13, 0}; - -const int JsonGrammar::rule_index [] = { - 0, 2, 6, 10, 16, 17, 19, 21, 23, 25, - 27, 29, 31, 35, 37, 41, 42}; -#endif // QLALR_NO_JSONGRAMMAR_DEBUG_INFO - -const short JsonGrammar::action_default [] = { - 0, 10, 9, 0, 6, 5, 16, 8, 11, 12, - 7, 1, 17, 0, 0, 0, 2, 0, 0, 4, - 0, 3, 14, 0, 0, 13, 15}; - -const short JsonGrammar::goto_default [] = { - 3, 11, 2, 13, 1, 23, 0}; - -const short JsonGrammar::action_index [] = { - 24, -13, -13, 12, -13, -1, 24, -13, -13, -13, - -13, -13, -13, 1, -5, 2, -13, -6, 24, -13, - 24, -13, -13, -2, 24, -13, -13, - - -7, -7, -7, -7, -7, -7, 1, -7, -7, -7, - -7, -7, -7, -7, -7, -7, -7, -7, 0, -7, - -1, -7, -7, -7, 5, -7, -7}; - -const short JsonGrammar::action_info [] = { - 14, 18, 20, 17, 25, 16, 24, 0, 0, 15, - 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 9, 8, 5, 0, 6, - 0, 0, 0, 4, 10, 7, 0, - - 21, 19, 22, 0, 0, 0, 26, 0, 0, 0, - 0, 0}; - -const short JsonGrammar::action_check [] = { - 1, 7, 7, 1, 6, 4, 8, -1, -1, 8, - -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 1, 2, 3, -1, 5, - -1, -1, -1, 9, 10, 11, -1, - - 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, - -1, -1}; - - -#line 29 "json.g" - -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#ifndef JSONPARSER_P_H -#define JSONPARSER_P_H - -#include <QString> -#include <QVariant> -#include <QVector> - -class JsonLexer -{ -public: - JsonLexer(const QString &string); - ~JsonLexer(); - - int lex(); - QVariant symbol() const { return m_symbol; } - int lineNumber() const { return m_lineNumber; } - int pos() const { return m_pos; } - -private: - int parseNumber(); - int parseString(); - int parseKeyword(); - - QString m_strdata; - int m_lineNumber; - int m_pos; - QVariant m_symbol; -}; - -class JsonParser : protected JsonGrammar -{ -public: - JsonParser(); - ~JsonParser(); - - bool parse(JsonLexer *lex); - QVariant result() const { return m_result; } - QString errorMessage() const { return QString::fromLatin1("%1 at line %2 pos %3").arg(m_errorMessage).arg(m_errorLineNumber).arg(m_errorPos); } - -private: - void reallocateStack(); - - inline QVariant &sym(int index) - { return m_symStack[m_tos + index - 1]; } - inline QVariantMap &map(int index) - { return m_mapStack[m_tos + index - 1]; } - inline QVariantList &list(int index) - { return m_listStack[m_tos + index - 1]; } - - int m_tos; - QVector<int> m_stateStack; - QVector<QVariant> m_symStack; - QVector<QVariantMap> m_mapStack; - QVector<QVariantList> m_listStack; - QString m_errorMessage; - int m_errorLineNumber; - int m_errorPos; - QVariant m_result; -}; - -#endif // JSONPARSER_P_H - -#line 103 "json.g" - -/**************************************************************************** -** -** Copyright (c) 2010 Girish Ramakrishnan <girish@forwardbias.in> -** Copyright (c) 2011 Denis Dzyubenko <shadone@gmail.com> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include <QtDebug> - -#define L1C(c) ushort(uchar(c)) - -JsonLexer::JsonLexer(const QString &str) - : m_strdata(str), m_lineNumber(1), m_pos(0) -{ -} - - - -JsonLexer::~JsonLexer() -{ -} - -int JsonLexer::parseString() -{ - bool esc = false; - ++m_pos; // skip initial " - int start = m_pos; - - const ushort *uc = m_strdata.utf16(); - const int remaining = m_strdata.length() - m_pos; - int i; - for (i = 0; i < remaining; ++i) { - const ushort c = uc[m_pos + i]; - if (c == L1C('\"')) { - m_symbol = QString((QChar *)uc + m_pos, i); - m_pos += i; - ++m_pos; // eat quote - return JsonGrammar::T_STRING; - } else if (c == L1C('\\')) { - ++m_pos; // eat backslash - esc = true; - break; - } - } - - QString str; - if (i) { - str.resize(i); - memcpy((char *)str.utf16(), uc + start, i * 2); - m_pos += i; - } - - for (; m_pos < m_strdata.length(); ++m_pos) { - const ushort c = uc[m_pos]; - if (esc) { - if (c == L1C('b')) str += QLatin1Char('\b'); - else if (c == L1C('f')) str += QLatin1Char('\f'); - else if (c == L1C('n')) str += QLatin1Char('\n'); - else if (c == L1C('r')) str += QLatin1Char('\r'); - else if (c == L1C('t')) str += QLatin1Char('\t'); - else if (c == L1C('\\')) str += QLatin1Char('\\'); - else if (c == L1C('\"')) str += QLatin1Char('\"'); - else if (c == L1C('u') && m_pos+4<m_strdata.length()-1) { - // FIXME: This code is wrong - QString u1 = m_strdata.mid(m_pos+1, 2); // TODO: QStringRef please - QString u2 = m_strdata.mid(m_pos+3, 2); - bool ok; - str += QChar(u2.toInt(&ok, 16), u1.toInt(&ok, 16)); - m_pos += 4; - } else { - str += QChar(c); - } - esc = false; - } else if (c == L1C('\\')) { - esc = true; - } else if (c == L1C('\"')) { - m_symbol = str; - ++m_pos; - return JsonGrammar::T_STRING; - } else { - str += QChar(c); - } - } - return JsonGrammar::ERROR; -} - -int JsonLexer::parseNumber() -{ - int start = m_pos; - bool isDouble = false; - const ushort *uc = m_strdata.utf16(); - const int l = m_strdata.length(); - const int negative = (uc[m_pos] == L1C('-') ? ++m_pos, -1 : (uc[m_pos] == L1C('+') ? ++m_pos, 1 : 1)); - qlonglong value = 0; - for (; m_pos < l; ++m_pos) { - const ushort &c = uc[m_pos]; - if (c == L1C('+') || c == L1C('-')) - continue; - if (c == L1C('.') || c == L1C('e') || c == L1C('E')) { - isDouble = true; - continue; - } - if (c >= L1C('0') && c <= L1C('9')) { - if (!isDouble) { - value *= 10; - value += c - L1C('0'); - } - continue; - } - break; - } - if (!isDouble) { - m_symbol = value * negative; - } else { - QString number = QString::fromRawData((QChar *)uc+start, m_pos-start); - m_symbol = number.toDouble(); - } - return JsonGrammar::T_NUMBER; -} - -int JsonLexer::parseKeyword() -{ - int start = m_pos; - for (; m_pos < m_strdata.length(); ++m_pos) { - const ushort c = m_strdata.at(m_pos).unicode(); - if (c >= L1C('a') && c <= L1C('z')) - continue; - break; - } - const ushort *k = (const ushort *)m_strdata.constData() + start; - const int l = m_pos-start; - if (l == 4) { - static const ushort true_data[] = { 't', 'r', 'u', 'e' }; - static const ushort null_data[] = { 'n', 'u', 'l', 'l' }; - if (!memcmp(k, true_data, 4)) - return JsonGrammar::T_TRUE; - if (!memcmp(k, null_data, 4)) - return JsonGrammar::T_NULL; - } else if (l == 5) { - static const ushort false_data[] = { 'f', 'a', 'l', 's', 'e' }; - if (!memcmp(k, false_data, 5)) - return JsonGrammar::T_FALSE; - } - return JsonGrammar::ERROR; -} - -int JsonLexer::lex() -{ - m_symbol.clear(); - - const ushort *uc = m_strdata.utf16(); - const int len = m_strdata.length(); - while (m_pos < len) { - const ushort c = uc[m_pos]; - switch (c) { - case L1C('['): ++m_pos; return JsonGrammar::T_LSQUAREBRACKET; - case L1C(']'): ++m_pos; return JsonGrammar::T_RSQUAREBRACKET; - case L1C('{'): ++m_pos; return JsonGrammar::T_LCURLYBRACKET; - case L1C('}'): ++m_pos; return JsonGrammar::T_RCURLYBRACKET; - case L1C(':'): ++m_pos; return JsonGrammar::T_COLON; - case L1C(','): ++m_pos; return JsonGrammar::T_COMMA; - case L1C(' '): case L1C('\r'): case L1C('\t'): ++m_pos; break; - case L1C('\n'): ++m_pos; ++m_lineNumber; break; - case L1C('"'): return parseString(); - default: - if (c == L1C('+') || c == L1C('-') || (c >= L1C('0') && c <= L1C('9'))) { - return parseNumber(); - } - if (c >= L1C('a') && c <= L1C('z')) { - return parseKeyword(); - } - return JsonGrammar::ERROR; - } - } - return JsonGrammar::EOF_SYMBOL; -} -#undef L1C - -JsonParser::JsonParser() -{ -} - -JsonParser::~JsonParser() -{ -} - -void JsonParser::reallocateStack() -{ - int size = m_stateStack.size(); - if (size == 0) - size = 128; - else - size <<= 1; - - m_symStack.resize(size); - m_mapStack.resize(size); - m_listStack.resize(size); - m_stateStack.resize(size); -} - -bool JsonParser::parse(JsonLexer *lexer) -{ - const int INITIAL_STATE = 0; - int yytoken = -1; - reallocateStack(); - m_tos = 0; - m_stateStack[++m_tos] = INITIAL_STATE; - - while (true) { - const int state = m_stateStack[m_tos]; - if (yytoken == -1 && -TERMINAL_COUNT != action_index[state]) { - yytoken = lexer->lex(); - } - int act = t_action(state, yytoken); - if (act == ACCEPT_STATE) - return true; - else if (act > 0) { - if (++m_tos == m_stateStack.size()) - reallocateStack(); - m_stateStack[m_tos] = act; - m_symStack[m_tos] = lexer->symbol(); - yytoken = -1; - } else if (act < 0) { - int r = -act-1; - m_tos -= rhs[r]; - act = m_stateStack.at(m_tos++); - switch (r) { - -#line 337 "json.g" - case 0: { m_result = sym(1); break; } -#line 340 "json.g" - case 1: { sym(1) = map(2); break; } -#line 343 "json.g" - case 2: { QVariantMap m; m.insert(sym(1).toString(), sym(3)); map(1) = m; break; } -#line 346 "json.g" - case 3: { map(1).insert(sym(3).toString(), sym(5)); break; } -#line 349 "json.g" - case 4: { map(1) = QVariantMap(); break; } -#line 352 "json.g" - case 5: { sym(1) = QVariant(false); break; } -#line 355 "json.g" - case 6: { sym(1) = QVariant(true); break; } -#line 364 "json.g" - case 12: { sym(1) = list(2); break; } -#line 367 "json.g" - case 13: { QVariantList l; l.append(sym(1)); list(1) = l; break; } -#line 370 "json.g" - case 14: { list(1).append(sym(3)); break; } -#line 373 "json.g" - case 15: { list(1) = QVariantList(); break; } -#line 375 "json.g" - - } // switch - m_stateStack[m_tos] = nt_action(act, lhs[r] - TERMINAL_COUNT); - } else { - int ers = state; - int shifts = 0; - int reduces = 0; - int expected_tokens[3]; - for (int tk = 0; tk < TERMINAL_COUNT; ++tk) { - int k = t_action(ers, tk); - - if (! k) - continue; - else if (k < 0) - ++reduces; - else if (spell[tk]) { - if (shifts < 3) - expected_tokens[shifts] = tk; - ++shifts; - } - } - - m_errorLineNumber = lexer->lineNumber(); - m_errorPos = lexer->pos(); - m_errorMessage.clear(); - if (shifts && shifts < 3) { - bool first = true; - - for (int s = 0; s < shifts; ++s) { - if (first) - m_errorMessage += QLatin1String("Expected "); - else - m_errorMessage += QLatin1String(", "); - - first = false; - m_errorMessage += QLatin1String("'"); - m_errorMessage += QLatin1String(spell[expected_tokens[s]]); - m_errorMessage += QLatin1String("'"); - } - } - return false; - } - } - - return false; -} - - -#endif // JSONPARSER_CPP - diff --git a/src/3rdparty/qjson/tests/data/non-latin1.json b/src/3rdparty/qjson/tests/data/non-latin1.json deleted file mode 100644 index 4adddef3..00000000 --- a/src/3rdparty/qjson/tests/data/non-latin1.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "தஹெரா" -} - diff --git a/src/3rdparty/qjson/tests/data/non-latin1.json.ref b/src/3rdparty/qjson/tests/data/non-latin1.json.ref deleted file mode 100644 index 42f0b7fe..00000000 --- a/src/3rdparty/qjson/tests/data/non-latin1.json.ref +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "\u0ba4\u0bb9\u0bc6\u0bb0\u0bbe" -} - diff --git a/src/3rdparty/qjson/tests/data/test.html b/src/3rdparty/qjson/tests/data/test.html deleted file mode 100644 index bb3b40c5..00000000 --- a/src/3rdparty/qjson/tests/data/test.html +++ /dev/null @@ -1,72 +0,0 @@ -<html> -<script> - JSON_STRING = '[\ - "JSON Test Pattern pass1",\ - {"object with 1 member":["array with 1 element"]},\ - {},\ - [],\ - -42,\ - true,\ - false,\ - null,\ - {\ - "integer": 1234567890,\ - "real": -9876.543210,\ - "e": 0.123456789e-12,\ - "E": 1.234567890E+34,\ - "": 23456789012E66,\ - "zero": 0,\ - "one": 1,\ - "space": " ",\ - "quote": "\\"",\ - "backslash": "\\\\",\ - "controls": "\\b\\f\\n\\r\\t",\ - "slash": "/ & \\/",\ - "alpha": "abcdefghijklmnopqrstuvwxyz",\ - "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",\ - "digit": "0123456789",\ - "0123456789": "digit",\ - "special": "`1~!@#$%^&*()_+-={\':[,]}|;.</>?",\ - "hex": "\\u0123\\u4567\\u89AB\\uCDEF\\uabcd\\uef4A",\ - "true": true,\ - "false": false,\ - "null": null,\ - "array":[ ],\ - "object":{ },\ - "address": "50 St. James Street",\ - "url": "http://www.JSON.org/",\ - "comment": "// /* <!-- --",\ - "# -- --> */": " ",\ - " s p a c e d " :[1,2 , 3\ -\ -,\ -\ -4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],\ - "jsontext": "{\\\"object with 1 member\\\":[\\\"array with 1 element\\\"]}",\ - "quotes": "" \\u0022 %22 0x22 034 "",\ - "\\/\\\\\\"\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?" : "A key can be any string"\ - },\ - 0.5 ,98.6\ -,\ -99.44\ -,\ -\ -1066,\ -1e1,\ -0.1e1,\ -1e-1,\ -1e00,\ -2e+00,\ -2e-00,\ -"rosebud"]'; - - function testJson() { - var obj = JSON.parse(JSON_STRING); - document.write(JSON.stringify(obj)) - } -</script> - -<body onload="testJson()"> - Hello -</body> -</html>
\ No newline at end of file diff --git a/src/3rdparty/qjson/tests/data/test.json b/src/3rdparty/qjson/tests/data/test.json deleted file mode 100644 index c5b8e211..00000000 --- a/src/3rdparty/qjson/tests/data/test.json +++ /dev/null @@ -1,60 +0,0 @@ -[ - "JSON Test Pattern pass1", - {"object with 1 member":["array with 1 element"]}, - {}, - [], - -42, - true, - false, - null, - { - "integer": 1234567890, - "real": -9876.543210, - "e": 0.123456789e-12, - "E": 1.234567890E+34, - "": 23456789012E66, - "zero": 0, - "one": 1, - "space": " ", - "quote": "\"", - "backslash": "\\", - "controls": "\b\f\n\r\t", - "slash": "/ & \/", - "alpha": "abcdefghijklmnopqrstuvwxyz", - "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "digit": "0123456789", - "0123456789": "digit", - "special": "`1~!@#$%^&*()_+-={\':[,]}|;.</>?", - "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", - "true": true, - "false": false, - "null": null, - "array":[ ], - "object":{ }, - "address": "50 St. James Street", - "url": "http://www.JSON.org/", - "comment": "// /* <!-- --", - "# -- --> */": " ", - " s p a c e d " :[1,2 , 3 - -, - -4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7], - "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", - "quotes": "" \u0022 %22 0x22 034 "", - "\/\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?" : "A key can be any string" - }, - 0.5 ,98.6 -, -99.44 -, - -1066, -1e1, -0.1e1, -1e-1, -1e00, -2e+00, -2e-00, -"rosebud"] - diff --git a/src/3rdparty/qjson/tests/data/test.json.ref b/src/3rdparty/qjson/tests/data/test.json.ref deleted file mode 100644 index b4206236..00000000 --- a/src/3rdparty/qjson/tests/data/test.json.ref +++ /dev/null @@ -1,57 +0,0 @@ -[ - "JSON Test Pattern pass1", - {"object with 1 member":["array with 1 element"]}, - {}, - [], - -42, - true, - false, - null, - { - "": 2.3456789012e+76, - " s p a c e d " :[1,2 , 3,4 , 5, 6 ,7], - "# -- --> *\/": " ", - "\/\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?" : "A key can be any string", - "0123456789": "digit", - "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "E": 1.23456789e+34, - "address": "50 St. James Street", - "alpha": "abcdefghijklmnopqrstuvwxyz", - "array":[ ], - "backslash": "\\", - "comment": "\/\/ \/* <!-- --", - "compact":[1,2,3,4,5,6,7], - "controls": "\b\f\n\r\t", - "digit": "0123456789", - "e": 1.23456789e-13, - "false": false, - "hex": "\u0123\u4567\u89ab\ucdef\uabcd\uef4a", - "integer": 1234567890, - "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", - "null": null, - "object":{ }, - "one": 1, - "quote": "\"", - "quotes": "" \" %22 0x22 034 "", - "real": -9876.54321, - "slash": "\/ & \/", - "space": " ", - "special": "`1~!@#$%^&*()_+-={':[,]}|;.<\/>?", - "true": true, - "url": "http:\/\/www.JSON.org\/", - "zero": 0 - }, - 0.5 ,98.6 -, -99.44 -, - -1066, -10, -1, -0.1, -1, -2, -2, -"rosebud"] - diff --git a/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json b/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json Binary files differdeleted file mode 100644 index aed8eb32..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json +++ /dev/null diff --git a/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json.ref b/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json.ref Binary files differdeleted file mode 100644 index 8b9d9b91..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-16le-nobom.json.ref +++ /dev/null diff --git a/src/3rdparty/qjson/tests/data/test_utf-16le.json b/src/3rdparty/qjson/tests/data/test_utf-16le.json Binary files differdeleted file mode 100644 index 277dc529..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-16le.json +++ /dev/null diff --git a/src/3rdparty/qjson/tests/data/test_utf-16le.json.ref b/src/3rdparty/qjson/tests/data/test_utf-16le.json.ref Binary files differdeleted file mode 100644 index 8b9d9b91..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-16le.json.ref +++ /dev/null diff --git a/src/3rdparty/qjson/tests/data/test_utf-32le.json b/src/3rdparty/qjson/tests/data/test_utf-32le.json Binary files differdeleted file mode 100644 index 7345dafb..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-32le.json +++ /dev/null diff --git a/src/3rdparty/qjson/tests/data/test_utf-32le.json.ref b/src/3rdparty/qjson/tests/data/test_utf-32le.json.ref Binary files differdeleted file mode 100644 index 2624ef36..00000000 --- a/src/3rdparty/qjson/tests/data/test_utf-32le.json.ref +++ /dev/null diff --git a/src/3rdparty/qjson/tests/tests.pro b/src/3rdparty/qjson/tests/tests.pro deleted file mode 100644 index 1f0de7ae..00000000 --- a/src/3rdparty/qjson/tests/tests.pro +++ /dev/null @@ -1,13 +0,0 @@ -QT += testlib - -include(../src/json.pri) -SOURCES += tst_json.cpp - -TARGET = tst_json - -wince { - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - diff --git a/src/3rdparty/qjson/tests/tst_json.cpp b/src/3rdparty/qjson/tests/tst_json.cpp deleted file mode 100644 index 1dceea73..00000000 --- a/src/3rdparty/qjson/tests/tst_json.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (c) 2011 Girish Ramakrishnan <girish@forwardbias.in> -** -** Use, modification and distribution is allowed without limitation, -** warranty, liability or support of any kind. -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include "json.h" - -class tst_Json : public QObject -{ - Q_OBJECT - -private slots: - void parseAndStringify_data(); - void parseAndStringify(); - - void stringify_data(); - void stringify(); - - void parseError_data(); - void parseError(); -}; - -static QByteArray unformat(const QByteArray &input) -{ - QByteArray output; - bool inQuote = false, escape = false; - for (int i = 0; i < input.count(); i++) { - char c = input[i]; - if (escape) { - escape = false; - } else if (c == '\\') { - escape = true; - } else { - if (c == '\"') - inQuote = !inQuote; - if (!inQuote && (c == ' ' || c == '\r' || c == '\n' || c == '\t')) - continue; - } - output += c; - } - return output; -} - -void tst_Json::parseAndStringify_data() -{ - QTest::addColumn<QByteArray>("json"); - QTest::addColumn<QByteArray>("reference"); // always UTF-8 - QDir dir; - dir.cd(QLatin1String(SRCDIR "data/")); - foreach(QString filename , dir.entryList(QStringList() << QLatin1String("*.json"))) { - QFile jsonFile(dir.filePath(filename)); - jsonFile.open(QFile::ReadOnly); - QByteArray json = jsonFile.readAll(); - QFile refFile(dir.filePath(filename + QLatin1String(".ref"))); - QByteArray reference; - if (refFile.open(QFile::ReadOnly)) { - reference = refFile.readAll(); - } else { - reference = json; - } - if (filename.contains(QLatin1String("utf-16"))) { - reference = QTextCodec::codecForName("UTF-16LE")->toUnicode(reference).toUtf8(); - } else if (filename.contains(QLatin1String("utf-32"))) { - reference = QTextCodec::codecForName("UTF-32LE")->toUnicode(reference).toUtf8(); - } - reference = unformat(reference); - QTest::newRow(dir.filePath(filename).toLatin1().data()) << json << reference; - } -} - -void tst_Json::parseAndStringify() -{ - QFETCH(QByteArray, json); - QFETCH(QByteArray, reference); - - JsonReader reader; - QVERIFY2(reader.parse(json), reader.errorString().toLocal8Bit().constData()); - QVariant result = reader.result(); - - JsonWriter writer; - QByteArray jsonAgain = writer.toByteArray(result); - QVERIFY(jsonAgain == reference); - - // test pretty writing - writer.setAutoFormatting(true); - jsonAgain = writer.toByteArray(result); - QVERIFY(unformat(jsonAgain) == reference); -} - -struct CustomType { - int x; -}; -Q_DECLARE_METATYPE(CustomType) - -void tst_Json::stringify_data() -{ - QTest::addColumn<QVariant>("input"); - QTest::addColumn<QString>("output"); - - QTest::newRow("null_variant") << QVariant() << "null"; - - // bool - QTest::newRow("true") << QVariant(true) << "true"; - QTest::newRow("false") << QVariant(false) << "false"; - - // lists - QTest::newRow("empty list") << QVariant(QVariantList()) << "[]"; - - // objects - QTest::newRow("empty object") << QVariant(QVariantMap()) << "{}"; - - // numbers - QTest::newRow("number") << QVariant(42) << "42"; - QTest::newRow("nan") << QVariant(double(NAN)) << "null"; - QTest::newRow("inf") << QVariant(double(INFINITY)) << "null"; - QTest::newRow("-inf") << QVariant(double(-INFINITY)) << "null"; - - // unicode - QTest::newRow("non-ascii/latin1") << QVariant(QChar(0xFB)) << "\"\\u00fb\""; - - const char utf8[] = {0xE0, 0xAE, 0x9F, 0xE0, 0xAE, 0xBF, 0x00 }; - QTest::newRow("tamil tee") << QVariant(QString::fromUtf8(utf8)) << "\"\\u0b9f\\u0bbf\""; - - // various QVariant types - QVariantList vlist; - vlist = QVariantList() << QVariant(float(1)) << QVariant(qlonglong(13)) - << QVariant(qulonglong(14)) << QVariant(quint32(15)) - << QVariant(char('x')) << QVariant(QChar(QLatin1Char('X'))); - QTest::newRow("various types") << QVariant(vlist) << "[1,13,14,15,120,\"X\"]"; - - // custom types - // It is out of the scope of the standard to specify what happens when - // a custom type that cannot be stringized is present. We generate a null - // for unsupported types - CustomType c; - QTest::newRow("unpresentable object") << qVariantFromValue(c) << "null"; - - vlist = QVariantList() << 1 << qVariantFromValue(c) << 2; - QTest::newRow("unpresentable object[]") << QVariant(vlist) << "[1,null,2]"; - - QVariantMap map; - map[QLatin1String("one")] = 1; - map[QLatin1String("two")] = 2; - map[QLatin1String("custom")] = qVariantFromValue(c); - QTest::newRow("unpresentable object{}") << QVariant(map) << "{\"custom\":null,\"one\":1,\"two\":2}"; -} - -void tst_Json::stringify() -{ - QFETCH(QVariant, input); - QFETCH(QString, output); - - JsonWriter writer; - QCOMPARE(writer.toString(input), output); - - // just check if it parses, just in case - JsonReader reader; - QVERIFY(reader.parse(writer.toString(input))); -} - -void tst_Json::parseError_data() -{ - QTest::addColumn<QString>("input"); - QTest::addColumn<int>("line"); - QTest::addColumn<int>("pos"); - QTest::addColumn<QString>("expect"); - - // Most of the time the error message itself is not useful. These tests exist - // primarily to make sure that parsing fails - QTest::newRow("error 1") << "!" << 1 << 0 << ""; - QTest::newRow("error 2") << "[1,2," << 1 << 5 << ""; - QTest::newRow("error 3") << "[1,2" << 1 << 4 << "Expected ']', ','"; - QTest::newRow("error 4") << "[1,2p" << 1 << 5 << "Expected ']', ','"; - QTest::newRow("error 5") << "[1,2] {" << 1 << 7 << "Expected 'end of file'"; - QTest::newRow("error 6") << "{ foo: bar }" << 1 << 5 << "Expected '}', ','"; - QTest::newRow("error 7") << "\n\n{ \"cat\" : \"pillar\"" << 3 << 20 << "Expected '}', ','"; - QTest::newRow("success") << "true" << -1 << -1 << ""; -} - -void tst_Json::parseError() -{ - QFETCH(QString, input); - QFETCH(int, line); - QFETCH(int, pos); - QFETCH(QString, expect); - - JsonReader reader; - QVERIFY(!reader.parse(input) || line == -1); - - if (line != -1) - QCOMPARE(reader.errorString(), QString::fromUtf8("%1 at line %2 pos %3").arg(expect).arg(line).arg(pos)); -} - -QTEST_MAIN(tst_Json) - -#include "tst_json.moc" - diff --git a/src/common/common.pri b/src/common/common.pri index 8a5190af..a72a792e 100644 --- a/src/common/common.pri +++ b/src/common/common.pri @@ -1,7 +1,5 @@ INCLUDEPATH += $$PWD -include(../3rdparty/qjson/qjson.pri) - unix { contains(QT_CONFIG,icu) { LIBS += -licuuc -licui18n diff --git a/src/daemon/dbserver.cpp b/src/daemon/dbserver.cpp index 592b1b34..95a1bff2 100644 --- a/src/daemon/dbserver.cpp +++ b/src/daemon/dbserver.cpp @@ -43,8 +43,6 @@ #include <QtNetwork> #include <QElapsedTimer> -#include <json.h> - #include "jsondb-strings.h" #include "jsondb-error.h" @@ -711,14 +709,15 @@ void DBServer::debugQuery(JsonDbQuery *query, int limit, int offset, const JsonD for (int i = 0; i < orQueryTerms.size(); i++) { const OrQueryTerm &orQueryTerm = orQueryTerms[i]; foreach (const QueryTerm &queryTerm, orQueryTerm.terms()) { - if (jsondbSettings->verbose()) + if (jsondbSettings->verbose()) { qDebug() << __FILE__ << __LINE__ - << QString(" %1%2%3 %4 %5 ") - .arg(queryTerm.propertyName()) - .arg(queryTerm.joinField().size() ? "->" : "") - .arg(queryTerm.joinField()) - .arg(queryTerm.op()) - .arg(JsonWriter().toString(queryTerm.value().toVariant())); + << QString(" %1%2%3 %4") + .arg(queryTerm.propertyName()) + .arg(queryTerm.joinField().size() ? "->" : "") + .arg(queryTerm.joinField()) + .arg(queryTerm.op()) + << queryTerm.value(); + } } } diff --git a/src/daemon/jsondbmapdefinition.cpp b/src/daemon/jsondbmapdefinition.cpp index fd9413f1..23236ec8 100644 --- a/src/daemon/jsondbmapdefinition.cpp +++ b/src/daemon/jsondbmapdefinition.cpp @@ -53,7 +53,6 @@ #include "jsondbpartition.h" #include "jsondb-strings.h" #include "jsondb-error.h" -#include "json.h" #include "jsondbproxy.h" #include "jsondbobjecttable.h" diff --git a/src/daemon/jsondbpartition.cpp b/src/daemon/jsondbpartition.cpp index d02e6fd6..b365230e 100644 --- a/src/daemon/jsondbpartition.cpp +++ b/src/daemon/jsondbpartition.cpp @@ -59,7 +59,6 @@ #include <unistd.h> #include <stdlib.h> -#include "json.h" #include "jsondb-strings.h" #include "jsondb-error.h" #include "jsondbpartition.h" @@ -1554,8 +1553,8 @@ bool JsonDbPartition::checkNaturalObjectType(const JsonDbObject &object, QString { QString type = object.value(JsonDbString::kTypeStr).toString(); if (mViewTypes.contains(type)) { - QString str = JsonWriter().toString(object.toVariantMap()); - errorMsg = QString("Cannot create/remove object of view type '%1': '%2'").arg(type).arg(str); + QByteArray str = QJsonDocument(object).toJson(); + errorMsg = QString("Cannot create/remove object of view type '%1': '%2'").arg(type).arg(QString::fromUtf8(str)); return false; } @@ -1898,13 +1897,13 @@ void JsonDbPartition::initSchemas() if (!mSchemas.contains(schemaName)) { QFile schemaFile(QString(":schema/%1.json").arg(schemaName)); schemaFile.open(QIODevice::ReadOnly); - JsonReader parser; - bool ok = parser.parse(schemaFile.readAll()); - if (!ok) { - qWarning() << "Parsing " << schemaName << " schema" << parser.errorString(); + QJsonParseError error; + QJsonDocument doc = QJsonDocument::fromJson(schemaFile.readAll(), &error); + if (doc.isNull()) { + qWarning() << "Parsing " << schemaName << " schema" << error.errorString(); return; } - QJsonObject schema = QJsonObject::fromVariantMap(parser.result().toMap()); + QJsonObject schema = doc.object(); JsonDbObject schemaObject; schemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); schemaObject.insert("name", schemaName); @@ -1924,13 +1923,13 @@ void JsonDbPartition::initSchemas() const QString capabilityName("RootCapability"); QFile capabilityFile(QString(":schema/%1.json").arg(capabilityName)); capabilityFile.open(QIODevice::ReadOnly); - JsonReader parser; - bool ok = parser.parse(capabilityFile.readAll()); - if (!ok) { - qWarning() << "Parsing " << capabilityName << " capability" << parser.errorString(); + QJsonParseError error; + QJsonDocument doc = QJsonDocument::fromJson(capabilityFile.readAll(), &error); + if (doc.isNull()) { + qWarning() << "Parsing " << capabilityName << " capability" << error.errorString(); return; } - JsonDbObject capability = QJsonObject::fromVariantMap(parser.result().toMap()); + JsonDbObject capability = doc.object(); QString name = capability.value("name").toString(); GetObjectsResult getObjectResponse = getObjects("capabilityName", name, "Capability"); int count = getObjectResponse.data.size(); diff --git a/src/daemon/jsondbreducedefinition.cpp b/src/daemon/jsondbreducedefinition.cpp index d59bcc60..ee45ab7f 100644 --- a/src/daemon/jsondbreducedefinition.cpp +++ b/src/daemon/jsondbreducedefinition.cpp @@ -52,7 +52,6 @@ #include "jsondbpartition.h" #include "jsondb-strings.h" #include "jsondb-error.h" -#include "json.h" #include "jsondbproxy.h" #include "jsondbsettings.h" diff --git a/tests/auto/accesscontrol/testjsondb.cpp b/tests/auto/accesscontrol/testjsondb.cpp index 1a9d022f..b88d5d59 100644 --- a/tests/auto/accesscontrol/testjsondb.cpp +++ b/tests/auto/accesscontrol/testjsondb.cpp @@ -47,7 +47,6 @@ #include <QDir> #include <QTime> -#include "json.h" #include "jsondbpartition.h" #include "jsondbsettings.h" @@ -111,8 +110,6 @@ private: JsonDbWriteResult update(JsonDbOwner *owner, JsonDbObject &object, JsonDbPartition::WriteMode mode = JsonDbPartition::OptimisticWrite); JsonDbWriteResult remove(JsonDbOwner *owner, JsonDbObject &object, JsonDbPartition::WriteMode mode = JsonDbPartition::OptimisticWrite); - QJsonValue readJsonFile(const QString &filename); - QJsonValue readJson(const QByteArray& json); void removeDbFiles(); private: @@ -545,45 +542,6 @@ void TestJsonDb::testIndexAccessControl() } } -QStringList strings = (QStringList() - << "abc" - << "def" - << "deaf" - << "leaf" - << "DEAF" - << "LEAF" - << "ghi" - << "foo/bar"); - -QStringList patterns = (QStringList() - ); - -QJsonValue TestJsonDb::readJsonFile(const QString& filename) -{ - QString filepath = filename; - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString() << json; - } - QVariant v = parser.result(); - return QJsonValue::fromVariant(v); -} - -QJsonValue TestJsonDb::readJson(const QByteArray& json) -{ - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << parser.errorString(); - } - QVariant v = parser.result(); - return QJsonObject::fromVariantMap(v.toMap()); -} - void TestJsonDb::notified(const QString nid, const JsonDbObject &o, const QString action) { Q_UNUSED(o); diff --git a/tests/auto/client/client.pro b/tests/auto/client/client.pro index 8ea5097f..d2952953 100644 --- a/tests/auto/client/client.pro +++ b/tests/auto/client/client.pro @@ -5,7 +5,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/client/test-jsondb-client.cpp b/tests/auto/client/test-jsondb-client.cpp index bd54e4ea..06ba79de 100644 --- a/tests/auto/client/test-jsondb-client.cpp +++ b/tests/auto/client/test-jsondb-client.cpp @@ -67,8 +67,6 @@ #include "jsondb-object.h" #include "jsondb-error.h" -#include "json.h" - #include "util.h" #include "clientwrapper.h" @@ -348,14 +346,7 @@ void TestJsonDbClient::initTestCase() waitForResponse1(id); // Add a schemaValidation tests object (must be done as root) - QFile schemaFile(findFile("create-test.json")); - schemaFile.open(QIODevice::ReadOnly); - QByteArray json = schemaFile.readAll(); - schemaFile.close(); - JsonReader parser; - bool ok = parser.parse(json); - QVERIFY2(ok, parser.errorString().toLocal8Bit()); - QVariantMap schemaBody = parser.result().toMap(); + QVariantMap schemaBody = readJsonFile(findFile("create-test.json")).toObject().toVariantMap(); //qDebug() << "schemaBody" << schemaBody; QVariantMap schemaObject; schemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); @@ -785,14 +776,7 @@ void TestJsonDbClient::find() void TestJsonDbClient::index() { - QFile dataFile(":/json/client/index-test.json"); - dataFile.open(QIODevice::ReadOnly); - QByteArray json = dataFile.readAll(); - dataFile.close(); - JsonReader parser; - bool ok = parser.parse(json); - QVERIFY2(ok, parser.errorString().toLocal8Bit()); - QVariantList data = parser.result().toList(); + QVariantList data = readJsonFile(":/json/client/index-test.json").toArray().toVariantList(); int id = mClient->create(data); waitForResponse1(id); @@ -1160,14 +1144,7 @@ void TestJsonDbClient::schemaValidation() { int id; if (!wasRoot) { - QFile schemaFile(findFile("create-test.json")); - schemaFile.open(QIODevice::ReadOnly); - QByteArray json = schemaFile.readAll(); - schemaFile.close(); - JsonReader parser; - bool ok = parser.parse(json); - QVERIFY2(ok, parser.errorString().toLocal8Bit()); - QVariantMap schemaBody = parser.result().toMap(); + QVariantMap schemaBody = readJsonFile(findFile("create-test.json")).toObject().toVariantMap(); //qDebug() << "schemaBody" << schemaBody; QVariantMap schemaObject; schemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); @@ -1307,17 +1284,11 @@ void TestJsonDbClient::notifyMultiple() void TestJsonDbClient::mapNotification() { - QFile jsonFile(":/json/auto/daemon/json/map-reduce.json"); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - QVERIFY(ok); - + QVariantList list = readJsonFile(":/json/auto/daemon/json/map-reduce.json").toArray().toVariantList(); QList<QVariantMap> mapsReduces; QList<QVariantMap> schemas; QMap<QString, QVariantMap> toDelete; - waitForResponse1(mClient->create(parser.result().toList())); + waitForResponse1(mClient->create(list)); QVariantList created = mData.toList(); foreach (const QVariant &c, created) { @@ -1406,9 +1377,6 @@ void TestJsonDbClient::changesSince() QVariantList results(data["changes"].toList()); QCOMPARE(results.count(), 2); - JsonWriter writer; - //qDebug() << writer.toByteArray(results[0]); - //qDebug() << writer.toByteArray(results[1]); QVERIFY(results[0].toMap()["before"].toMap().isEmpty()); QVERIFY(results[1].toMap()["before"].toMap().isEmpty()); diff --git a/tests/auto/daemon/testjsondb.cpp b/tests/auto/daemon/testjsondb.cpp index 0f185295..ce364aba 100644 --- a/tests/auto/daemon/testjsondb.cpp +++ b/tests/auto/daemon/testjsondb.cpp @@ -48,8 +48,6 @@ #include <QTime> #include <QUuid> -#include "json.h" - #include "jsondbmanagedbtree.h" #include "jsondbobjecttable.h" #include "jsondbpartition.h" @@ -245,8 +243,6 @@ private: void addSchema(const QString &schemaName, JsonDbObject &schemaObject); void addIndex(const QString &propertyName, const QString &propertyType=QString(), const QString &objectType=QString()); - QJsonValue readJsonFile(const QString &filename); - QJsonValue readJson(const QByteArray& json); void removeDbFiles(); private: @@ -340,16 +336,7 @@ void TestJsonDb::createContacts() if (!mContactList.isEmpty()) return; - QFile contactsFile(":/daemon/json/largeContactsTest.json"); - QVERIFY2(contactsFile.exists(), "Err: largeContactsTest.json doesn't exist!"); - - contactsFile.open(QIODevice::ReadOnly); - QByteArray json = contactsFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) - qDebug() << parser.errorString(); - QVariantList contactList = parser.result().toList(); + QVariantList contactList = readJsonFile(":/daemon/json/largeContactsTest.json").toArray().toVariantList(); QList<JsonDbObject> newContactList; foreach (QVariant v, contactList) { JsonDbObject contact(JsonDbObject::fromVariantMap(v.toMap())); @@ -1044,7 +1031,7 @@ void TestJsonDb::schemaValidation() id++; QString schemaName = QLatin1String("schemaValidationSchema") + QString::number(id); - QJsonObject schemaBody = readJson(schema).toObject(); + QJsonObject schemaBody = QJsonDocument::fromJson(schema).object(); JsonDbObject schemaObject; schemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); schemaObject.insert("name", schemaName); @@ -1053,7 +1040,7 @@ void TestJsonDb::schemaValidation() JsonDbWriteResult qResult = create(mOwner, schemaObject); verifyGoodResult(qResult); - JsonDbObject item = readJson(object).toObject(); + JsonDbObject item = QJsonDocument::fromJson(object).object(); item.insert(JsonDbString::kTypeStr, schemaName); // Create an item that matches the schema @@ -1125,8 +1112,8 @@ void TestJsonDb::schemaValidationExtends() " \"properties\": {\"age\": {\"minimum\": 18}}," " \"extends\": {\"$ref\":\"person%1\"}" "}").arg(QString::number(id)).toLatin1(); - QJsonObject personSchemaBody = readJson(person).toObject(); - QJsonObject adultSchemaBody = readJson(adult).toObject(); + QJsonObject personSchemaBody = QJsonDocument::fromJson(person).object(); + QJsonObject adultSchemaBody = QJsonDocument::fromJson(adult).object(); JsonDbObject personSchemaObject; personSchemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); @@ -1145,7 +1132,7 @@ void TestJsonDb::schemaValidationExtends() } { - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert("testingForPerson", isPerson); object.insert(JsonDbString::kTypeStr, personSchemaName); qResult = create(mOwner, object); @@ -1157,7 +1144,7 @@ void TestJsonDb::schemaValidationExtends() } { - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert("testingForAdult", isAdult); object.insert(JsonDbString::kTypeStr, adultSchemaName); qResult = create(mOwner, object); @@ -1223,9 +1210,9 @@ void TestJsonDb::schemaValidationExtendsArray() " \"extends\": [{\"$ref\":\"car%1\"}, {\"$ref\":\"boat%1\"}]" "}").arg(QString::number(id)).toLatin1(); - QJsonObject amphibiousSchemaBody = readJson(amphibious).toObject(); - QJsonObject carSchemaBody = readJson(car).toObject(); - QJsonObject boatSchemaBody = readJson(boat).toObject(); + QJsonObject amphibiousSchemaBody = QJsonDocument::fromJson(amphibious).object(); + QJsonObject carSchemaBody = QJsonDocument::fromJson(car).object(); + QJsonObject boatSchemaBody = QJsonDocument::fromJson(boat).object(); JsonDbObject carSchemaObject; @@ -1252,7 +1239,7 @@ void TestJsonDb::schemaValidationExtendsArray() } { - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert("testingForAmphibious", isValid); object.insert(JsonDbString::kTypeStr, amphibiousSchemaName); qResult = create(mOwner, object); @@ -1289,8 +1276,8 @@ void TestJsonDb::schemaValidationLazyInit() const QString personSchemaName = QString::fromLatin1("personLazyInit"); const QString adultSchemaName = QString::fromLatin1("adultLazyInit"); - QJsonObject personSchemaBody = readJson(person).toObject(); - QJsonObject adultSchemaBody = readJson(adult).toObject(); + QJsonObject personSchemaBody = QJsonDocument::fromJson(person).object(); + QJsonObject adultSchemaBody = QJsonDocument::fromJson(adult).object(); JsonDbObject personSchemaObject; personSchemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); @@ -1313,35 +1300,35 @@ void TestJsonDb::schemaValidationLazyInit() // Insert some objects to force full schema compilation { const QByteArray item = "{ \"name\":\"Nierob\", \"age\":99 }"; - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert(JsonDbString::kTypeStr, adultSchemaName); qResult = create(mOwner, object); verifyGoodResult(qResult); } { const QByteArray item = "{ \"name\":\"Nierob\", \"age\":12 }"; - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert(JsonDbString::kTypeStr, adultSchemaName); qResult = create(mOwner, object); verifyErrorResult(qResult); } { const QByteArray item = "{ \"age\":19 }"; - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert(JsonDbString::kTypeStr, adultSchemaName); qResult = create(mOwner, object); verifyErrorResult(qResult); } { const QByteArray item = "{ \"name\":\"Nierob\", \"age\":12 }"; - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert(JsonDbString::kTypeStr, personSchemaName); qResult = create(mOwner, object); verifyGoodResult(qResult); } { const QByteArray item = "{ \"age\":12 }"; - JsonDbObject object = readJson(item).toObject(); + JsonDbObject object = QJsonDocument::fromJson(item).object(); object.insert(JsonDbString::kTypeStr, personSchemaName); qResult = create(mOwner, object); verifyErrorResult(qResult); @@ -3500,32 +3487,6 @@ void TestJsonDb::find10() mJsonDbPartition->removeIndex("contact"); } -QJsonValue TestJsonDb::readJsonFile(const QString& filename) -{ - QString filepath = filename; - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - QVariant v = parser.result(); - return QJsonValue::fromVariant(v); -} - -QJsonValue TestJsonDb::readJson(const QByteArray& json) -{ - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << parser.errorString(); - } - QVariant v = parser.result(); - return QJsonObject::fromVariantMap(v.toMap()); -} - void TestJsonDb::startsWith() { addIndex(QLatin1String("name")); diff --git a/tests/auto/jsondb-listmodel/jsondb-listmodel.pro b/tests/auto/jsondb-listmodel/jsondb-listmodel.pro index 07d4eafc..fceabaaf 100644 --- a/tests/auto/jsondb-listmodel/jsondb-listmodel.pro +++ b/tests/auto/jsondb-listmodel/jsondb-listmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondb-listmodel/test-jsondb-listmodel.cpp b/tests/auto/jsondb-listmodel/test-jsondb-listmodel.cpp index 257b4323..bdd1bb3a 100644 --- a/tests/auto/jsondb-listmodel/test-jsondb-listmodel.cpp +++ b/tests/auto/jsondb-listmodel/test-jsondb-listmodel.cpp @@ -48,7 +48,6 @@ #include <QQmlComponent> #include <QQmlContext> #include <QDir> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -89,20 +88,6 @@ void TestJsonDbListModel::deleteDbFiles() } } -QVariant TestJsonDbListModel::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void TestJsonDbListModel::connectListModel(JsonDbListModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); @@ -677,7 +662,7 @@ void TestJsonDbListModel::totalRowCount() void TestJsonDbListModel::listProperty() { - QVariant jsonData = readJsonFile("list-objects.json"); + QVariant jsonData = readJsonFile(findFile("list-objects.json")).toVariant(); QVariantList itemList = jsonData.toList(); int id = 0; for (int i = 0; i < itemList.count(); i++) { diff --git a/tests/auto/jsondb-listmodel/test-jsondb-listmodel.h b/tests/auto/jsondb-listmodel/test-jsondb-listmodel.h index 96813049..a9d699f6 100644 --- a/tests/auto/jsondb-listmodel/test-jsondb-listmodel.h +++ b/tests/auto/jsondb-listmodel/test-jsondb-listmodel.h @@ -114,7 +114,6 @@ private: QStringList getOrderValues(const JsonDbListModel *listModel); JsonDbListModel *createModel(); void deleteModel(JsonDbListModel *model); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/auto/jsondbcachinglistmodel/jsondbcachinglistmodel.pro b/tests/auto/jsondbcachinglistmodel/jsondbcachinglistmodel.pro index eff7faa3..16c759cc 100644 --- a/tests/auto/jsondbcachinglistmodel/jsondbcachinglistmodel.pro +++ b/tests/auto/jsondbcachinglistmodel/jsondbcachinglistmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.cpp b/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.cpp index c11f048b..9ad9ee89 100644 --- a/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.cpp +++ b/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.cpp @@ -45,7 +45,6 @@ #include "../../shared/util.h" #include <QQmlListReference> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-cached-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -103,20 +102,6 @@ void TestJsonDbCachingListModel::deleteDbFiles() } } -QVariant TestJsonDbCachingListModel::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void TestJsonDbCachingListModel::connectListModel(QAbstractListModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); @@ -879,7 +864,7 @@ void TestJsonDbCachingListModel::totalRowCount() void TestJsonDbCachingListModel::listProperty() { - QVariant jsonData = readJsonFile("list-objects.json"); + QVariant jsonData = readJsonFile(findFile("list-objects.json")).toVariant(); QVariantList itemList = jsonData.toList(); int id = 0; for (int i = 0; i < itemList.count()/2; i++) { diff --git a/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.h b/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.h index 695efaf1..cc1f1422 100644 --- a/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.h +++ b/tests/auto/jsondbcachinglistmodel/testjsondbcachinglistmodel.h @@ -132,7 +132,6 @@ private: void createIndex(const QString &property, const QString &propertyType); QAbstractListModel *createModel(); void deleteModel(QAbstractListModel *model); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/auto/jsondbchangessinceobject/jsondbchangessinceobject.pro b/tests/auto/jsondbchangessinceobject/jsondbchangessinceobject.pro index cb94df5d..f40696e0 100644 --- a/tests/auto/jsondbchangessinceobject/jsondbchangessinceobject.pro +++ b/tests/auto/jsondbchangessinceobject/jsondbchangessinceobject.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbchangessinceobject/testjsondbchangessinceobject.cpp b/tests/auto/jsondbchangessinceobject/testjsondbchangessinceobject.cpp index 8ad35d50..19b11265 100644 --- a/tests/auto/jsondbchangessinceobject/testjsondbchangessinceobject.cpp +++ b/tests/auto/jsondbchangessinceobject/testjsondbchangessinceobject.cpp @@ -44,7 +44,6 @@ #include "testjsondbchangessinceobject.h" #include "../../shared/util.h" #include <QJSValueIterator> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-partition"; diff --git a/tests/auto/jsondblistmodel/jsondblistmodel.pro b/tests/auto/jsondblistmodel/jsondblistmodel.pro index 7aafd6ad..03be8e62 100644 --- a/tests/auto/jsondblistmodel/jsondblistmodel.pro +++ b/tests/auto/jsondblistmodel/jsondblistmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondblistmodel/testjsondblistmodel.cpp b/tests/auto/jsondblistmodel/testjsondblistmodel.cpp index 598353ca..d0be9cfd 100644 --- a/tests/auto/jsondblistmodel/testjsondblistmodel.cpp +++ b/tests/auto/jsondblistmodel/testjsondblistmodel.cpp @@ -43,7 +43,6 @@ #include <QJSEngine> #include "testjsondblistmodel.h" #include "../../shared/util.h" -#include "json.h" static const char dbfile[] = "dbFile-jsondb-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -108,20 +107,6 @@ void TestJsonDbListModel::deleteDbFiles() } } -QVariant TestJsonDbListModel::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void TestJsonDbListModel::connectListModel(QAbstractItemModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); @@ -678,7 +663,7 @@ void TestJsonDbListModel::totalRowCount() void TestJsonDbListModel::listProperty() { - QVariant jsonData = readJsonFile("list-objects.json"); + QVariant jsonData = readJsonFile(findFile("list-objects.json")).toVariant(); QVariantList itemList = jsonData.toList(); int id = 0; for (int i = 0; i < itemList.count(); i++) { diff --git a/tests/auto/jsondblistmodel/testjsondblistmodel.h b/tests/auto/jsondblistmodel/testjsondblistmodel.h index 79b8b851..36fbf332 100644 --- a/tests/auto/jsondblistmodel/testjsondblistmodel.h +++ b/tests/auto/jsondblistmodel/testjsondblistmodel.h @@ -115,7 +115,6 @@ private: QStringList getOrderValues(QAbstractItemModel *listModel); QAbstractItemModel *createModel(); void deleteModel(QAbstractItemModel *model); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/auto/jsondbnotification/jsondbnotification.pro b/tests/auto/jsondbnotification/jsondbnotification.pro index f4e1fd67..824ba10c 100644 --- a/tests/auto/jsondbnotification/jsondbnotification.pro +++ b/tests/auto/jsondbnotification/jsondbnotification.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbnotification/testjsondbnotification.cpp b/tests/auto/jsondbnotification/testjsondbnotification.cpp index 6e3610f5..9589e534 100644 --- a/tests/auto/jsondbnotification/testjsondbnotification.cpp +++ b/tests/auto/jsondbnotification/testjsondbnotification.cpp @@ -41,10 +41,9 @@ #include <QtTest/QtTest> #include <QJSEngine> +#include <QJSValueIterator> #include "testjsondbnotification.h" #include "../../shared/util.h" -#include <QJSValueIterator> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-partition"; diff --git a/tests/auto/jsondbpartition/jsondbpartition.pro b/tests/auto/jsondbpartition/jsondbpartition.pro index 09433e1f..1724f364 100644 --- a/tests/auto/jsondbpartition/jsondbpartition.pro +++ b/tests/auto/jsondbpartition/jsondbpartition.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbpartition/testjsondbpartition.cpp b/tests/auto/jsondbpartition/testjsondbpartition.cpp index bfdafa62..bf6a0b53 100644 --- a/tests/auto/jsondbpartition/testjsondbpartition.cpp +++ b/tests/auto/jsondbpartition/testjsondbpartition.cpp @@ -41,10 +41,9 @@ #include <QtTest/QtTest> #include <QJSEngine> +#include <QJSValueIterator> #include "testjsondbpartition.h" #include "../../shared/util.h" -#include <QJSValueIterator> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-partition"; @@ -87,20 +86,6 @@ void TestJsonDbPartition::deleteDbFiles() } } -QVariant TestJsonDbPartition::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void TestJsonDbPartition::initTestCase() { // make sure there is no old db files. diff --git a/tests/auto/jsondbpartition/testjsondbpartition.h b/tests/auto/jsondbpartition/testjsondbpartition.h index 74896a8a..f8635389 100644 --- a/tests/auto/jsondbpartition/testjsondbpartition.h +++ b/tests/auto/jsondbpartition/testjsondbpartition.h @@ -86,7 +86,6 @@ protected slots: private: ComponentData *createComponent(); void deleteComponent(ComponentData *componentData); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/auto/jsondbqueryobject/jsondbqueryobject.pro b/tests/auto/jsondbqueryobject/jsondbqueryobject.pro index 62157bb2..0e3daeaf 100644 --- a/tests/auto/jsondbqueryobject/jsondbqueryobject.pro +++ b/tests/auto/jsondbqueryobject/jsondbqueryobject.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbqueryobject/testjsondbqueryobject.cpp b/tests/auto/jsondbqueryobject/testjsondbqueryobject.cpp index 8205a18f..071e2d72 100644 --- a/tests/auto/jsondbqueryobject/testjsondbqueryobject.cpp +++ b/tests/auto/jsondbqueryobject/testjsondbqueryobject.cpp @@ -41,10 +41,9 @@ #include <QtTest/QtTest> #include <QJSEngine> +#include <QJSValueIterator> #include "testjsondbqueryobject.h" #include "../../shared/util.h" -#include <QJSValueIterator> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-partition"; diff --git a/tests/auto/jsondbsortinglistmodel/jsondbsortinglistmodel.pro b/tests/auto/jsondbsortinglistmodel/jsondbsortinglistmodel.pro index cea282e6..2915514d 100644 --- a/tests/auto/jsondbsortinglistmodel/jsondbsortinglistmodel.pro +++ b/tests/auto/jsondbsortinglistmodel/jsondbsortinglistmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.cpp b/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.cpp index 762ce59b..1d048f52 100644 --- a/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.cpp +++ b/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.cpp @@ -41,11 +41,10 @@ #include <QtTest/QtTest> #include <QJSEngine> +#include <QQmlListReference> #include "testjsondbsortinglistmodel.h" #include "../../shared/util.h" -#include <QQmlListReference> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -124,20 +123,6 @@ void TestJsonDbSortingListModel::deleteDbFiles() } } -QVariant TestJsonDbSortingListModel::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void TestJsonDbSortingListModel::connectListModel(QAbstractListModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); @@ -741,7 +726,7 @@ void TestJsonDbSortingListModel::totalRowCount() void TestJsonDbSortingListModel::listProperty() { - QVariant jsonData = readJsonFile("list-objects.json"); + QVariant jsonData = readJsonFile(findFile("list-objects.json")).toVariant(); QVariantList itemList = jsonData.toList(); int id = 0; for (int i = 0; i < itemList.count()/2; i++) { diff --git a/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.h b/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.h index 752eb9a7..4366e783 100644 --- a/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.h +++ b/tests/auto/jsondbsortinglistmodel/testjsondbsortinglistmodel.h @@ -126,7 +126,6 @@ private: QStringList getOrderValues(QAbstractListModel *listModel); QAbstractListModel *createModel(); void deleteModel(QAbstractListModel *model); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp b/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp index 3eb83653..1e2cd201 100644 --- a/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp +++ b/tests/auto/qjsondbwatcher/testqjsondbwatcher.cpp @@ -318,9 +318,7 @@ void TestQJsonDbWatcher::notificationTriggersView() { QVERIFY(mConnection); - QJsonParseError error; - QJsonArray array(readJsonFile(":/daemon/json/map-array-conversion.json", &error).array()); - QVERIFY(error.error == QJsonParseError::NoError); + QJsonArray array(readJsonFile(":/daemon/json/map-array-conversion.json").array()); QList<QJsonObject> objects; foreach (const QJsonValue v, array) objects.append(v.toObject()); diff --git a/tests/auto/queries/testjsondbqueries.cpp b/tests/auto/queries/testjsondbqueries.cpp index 6a07414d..0541adc9 100644 --- a/tests/auto/queries/testjsondbqueries.cpp +++ b/tests/auto/queries/testjsondbqueries.cpp @@ -48,7 +48,6 @@ #include <QTime> #include <QUuid> -#include "json.h" #include "jsondbowner.h" #include "jsondbpartition.h" #include "jsondbquery.h" @@ -218,15 +217,7 @@ void TestJsonDbQueries::initTestCase() mJsonDbPartition = new JsonDbPartition(kFilename, QStringLiteral("com.example.JsonDbTestQueries"), mOwner, this); mJsonDbPartition->open(); - QFile contactsFile(":/queries/dataset.json"); - QVERIFY2(contactsFile.exists(), "Err: dataset.json doesn't exist!"); - - contactsFile.open(QIODevice::ReadOnly); - QByteArray json = contactsFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - QVERIFY2(ok, parser.errorString().toAscii()); - QVariantList contactList = parser.result().toList(); + QVariantList contactList = readJsonFile(":/queries/dataset.json").toArray().toVariantList(); foreach (QVariant v, contactList) { JsonDbObject object(QJsonObject::fromVariantMap(v.toMap())); QString type = object.value("_type").toString(); diff --git a/tests/benchmarks/client/client-benchmark.cpp b/tests/benchmarks/client/client-benchmark.cpp index 7da74938..51dd827a 100644 --- a/tests/benchmarks/client/client-benchmark.cpp +++ b/tests/benchmarks/client/client-benchmark.cpp @@ -42,7 +42,6 @@ #include <QtTest/QtTest> #include "client-benchmark.h" #include "private/jsondb-connection_p.h" -#include <json.h> #include "util.h" @@ -100,13 +99,10 @@ void TestJson::initTestCase() QByteArray friendJson("{\"type\": \"object\", \"properties\": {\"name\": {\"type\": \"string\", \"indexed\": true}}}"); - JsonReader reader; - // Create schemas for the items - reader.parse(friendJson); QVariantMap friendSchema; friendSchema.insert("name", "Friends"); - friendSchema.insert("schema", reader.result()); + friendSchema.insert("schema", QJsonDocument::fromJson(friendJson).object().toVariantMap()); friendSchema.insert("_type", "_schemaType"); int id = mClient->create(friendSchema); waitForResponse1(id); diff --git a/tests/benchmarks/client/client.pro b/tests/benchmarks/client/client.pro index 0ae1dd8a..44c55ad0 100644 --- a/tests/benchmarks/client/client.pro +++ b/tests/benchmarks/client/client.pro @@ -5,10 +5,6 @@ QT = core network testlib jsondb jsondbcompat-private DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" -INCLUDEPATH += "../../../src/common" -INCLUDEPATH += "../../../src/3rdparty/qjson/src" -SOURCES += ../../../src/3rdparty/qjson/src/json.cpp - CONFIG += qtestlib CONFIG -= app_bundle diff --git a/tests/benchmarks/daemon/bench_daemon.cpp b/tests/benchmarks/daemon/bench_daemon.cpp index 21fbcf71..29aa1a57 100644 --- a/tests/benchmarks/daemon/bench_daemon.cpp +++ b/tests/benchmarks/daemon/bench_daemon.cpp @@ -47,8 +47,6 @@ #include <QDir> #include <QTime> -#include "json.h" - #include "jsondbpartition.h" #include "jsondbindex.h" #include "jsondbindexquery.h" @@ -126,8 +124,6 @@ private slots: void benchmarkScriptEngineCreation(); private: - QJsonValue readJsonFile(const QString &filename); - QJsonValue readJson(const QByteArray &json); void removeDbFiles(); void addSchema(const QString &schemaName); void addIndex(const QString &propertyName, const QString &propertyType=QString(), const QString &objectType=QString()); @@ -606,7 +602,7 @@ void TestJsonDb::benchmarkSchemaValidation() static int schemaId = 0; const QString personSchemaName = QString::fromLatin1("personBenchmark") + QString::number(++schemaId); - QJsonObject personSchemaBody = readJson(person).toObject(); + QJsonObject personSchemaBody = QJsonDocument::fromJson(person).object(); JsonDbObject personSchemaObject; personSchemaObject.insert(JsonDbString::kTypeStr, JsonDbString::kSchemaTypeStr); personSchemaObject.insert("name", personSchemaName); @@ -619,7 +615,7 @@ void TestJsonDb::benchmarkSchemaValidation() QList<QJsonObject> objects; objects.reserve(numberOfIterations); for (uint i = 0; i < numberOfIterations; ++i) { - QJsonObject object = readJson(item).toObject(); + QJsonObject object = QJsonDocument::fromJson(item).object(); object.insert("testingForAdult", (int)i); object.insert(JsonDbString::kTypeStr, personSchemaName); objects.append(object); @@ -1002,32 +998,6 @@ void TestJsonDb::benchmarkQueryCount() } } -QJsonValue TestJsonDb::readJsonFile(const QString& filename) -{ - QString filepath = filename; - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - QVariant v = parser.result(); - return QJsonObject::fromVariantMap(v.toMap()); -} - -QJsonValue TestJsonDb::readJson(const QByteArray& json) -{ - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << parser.errorString(); - } - QVariant v = parser.result(); - return QJsonObject::fromVariantMap(v.toMap()); -} - void TestJsonDb::benchmarkScriptEngineCreation() { QJSValue result; diff --git a/tests/benchmarks/jsondb-listmodel/jsondb-listmodel.pro b/tests/benchmarks/jsondb-listmodel/jsondb-listmodel.pro index 3a8098f8..0aa62f5f 100644 --- a/tests/benchmarks/jsondb-listmodel/jsondb-listmodel.pro +++ b/tests/benchmarks/jsondb-listmodel/jsondb-listmodel.pro @@ -5,7 +5,6 @@ QT = core network testlib gui qml jsondbcompat-private CONFIG -= app_bundle include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" diff --git a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.cpp b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.cpp index 68c64854..18cd34aa 100644 --- a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.cpp +++ b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.cpp @@ -41,11 +41,10 @@ #include <QtTest/QtTest> #include <QJSEngine> +#include <QQmlListReference> #include "jsondbcachinglistmodel-bench.h" #include "../../shared/util.h" -#include <QQmlListReference> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-cached-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -97,20 +96,6 @@ void JsonDbCachingListModelBench::deleteDbFiles() } } -QVariant JsonDbCachingListModelBench::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void JsonDbCachingListModelBench::connectListModel(QAbstractListModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); diff --git a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.h b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.h index cfac030d..cb5b7d93 100644 --- a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.h +++ b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel-bench.h @@ -124,7 +124,6 @@ private: QAbstractListModel *createModel(); void deleteModel(QAbstractListModel *model); void deleteItems(const QString &type, const QString &partition); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel.pro b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel.pro index 1c0d1aeb..73530587 100644 --- a/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel.pro +++ b/tests/benchmarks/jsondbcachinglistmodel/jsondbcachinglistmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.cpp b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.cpp index 9691f2b8..b3931ef1 100644 --- a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.cpp +++ b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.cpp @@ -45,7 +45,6 @@ #include "../../shared/util.h" #include <QQmlListReference> -#include "json.h" static const char dbfile[] = "dbFile-jsondb-cached-listmodel"; ModelData::ModelData(): engine(0), component(0), model(0) @@ -97,20 +96,6 @@ void JsonDbSortingListModelBench::deleteDbFiles() } } -QVariant JsonDbSortingListModelBench::readJsonFile(const QString& filename) -{ - QString filepath = findFile(filename); - QFile jsonFile(filepath); - jsonFile.open(QIODevice::ReadOnly); - QByteArray json = jsonFile.readAll(); - JsonReader parser; - bool ok = parser.parse(json); - if (!ok) { - qDebug() << filepath << parser.errorString(); - } - return parser.result(); -} - void JsonDbSortingListModelBench::connectListModel(QAbstractListModel *model) { connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); diff --git a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.h b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.h index 68ae04f8..c077beb5 100644 --- a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.h +++ b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel-bench.h @@ -125,7 +125,6 @@ private: QAbstractListModel *createModel(); void deleteModel(QAbstractListModel *model); void deleteItems(const QString &type, const QString &partition); - QVariant readJsonFile(const QString &filename); private: QProcess *mProcess; diff --git a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel.pro b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel.pro index f1fe37ea..544352b0 100644 --- a/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel.pro +++ b/tests/benchmarks/jsondbsortinglistmodel/jsondbsortinglistmodel.pro @@ -8,7 +8,6 @@ CONFIG -= app_bundle CONFIG += testcase include($$PWD/../../shared/shared.pri) -include($$PWD/../../../src/3rdparty/qjson/qjson.pri) DEFINES += JSONDB_DAEMON_BASE=\\\"$$QT.jsondb.bins\\\" DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/shared/clientwrapper.h b/tests/shared/clientwrapper.h index 32e71db4..92ad8ee0 100644 --- a/tests/shared/clientwrapper.h +++ b/tests/shared/clientwrapper.h @@ -45,6 +45,10 @@ #include <QEventLoop> #include <QElapsedTimer> #include <QDebug> +#include <QJsonObject> +#include <QJsonArray> +#include <QJsonValue> +#include <QJsonDocument> #include "jsondb-client.h" @@ -81,7 +85,8 @@ QT_USE_NAMESPACE_JSONDB if ((result)->mNotificationId.isNull()) { \ QVERIFY2(false, "we expected notification but did not get it :("); \ } else { \ - QString data = JsonWriter().toString((result)->mNotifications.last().mObject); \ + QJsonValue value = QJsonValue::fromVariant((result)->mNotifications.last().mObject); \ + QString data = QString::fromUtf8(value.isArray() ? QJsonDocument(value.toArray()).toJson() : QJsonDocument(value.toObject()).toJson()); \ QByteArray ba = QString("we didn't expect notification but got it. %1").arg(data).toLatin1(); \ QVERIFY2(false, ba.constData()); \ } \ diff --git a/tests/shared/testhelper.cpp b/tests/shared/testhelper.cpp index d8dbb99e..b67c8002 100644 --- a/tests/shared/testhelper.cpp +++ b/tests/shared/testhelper.cpp @@ -49,6 +49,7 @@ #include <QProcess> #include <QTest> #include <QTimer> +#include <QJsonArray> QT_USE_NAMESPACE_JSONDB diff --git a/tests/shared/testhelper.h b/tests/shared/testhelper.h index c7954da1..c6e6610f 100644 --- a/tests/shared/testhelper.h +++ b/tests/shared/testhelper.h @@ -48,6 +48,7 @@ #include <QEventLoop> #include <QJsonDocument> +#include <QJsonValue> #include <QObject> #include <QStringList> diff --git a/tests/shared/util.h b/tests/shared/util.h index edd65fa8..0671f2f7 100644 --- a/tests/shared/util.h +++ b/tests/shared/util.h @@ -49,6 +49,8 @@ #include <QLocalSocket> #include <qtestsystem.h> #include <qjsondocument.h> +#include <qjsonarray.h> +#include <qjsonobject.h> inline QString findFile(const QString &filename) { @@ -73,7 +75,7 @@ inline QString findFile(const char *filename) return findFile(QString::fromLocal8Bit(filename)); } -QJsonDocument readJsonFile(const QString &filename, QJsonParseError *error = 0) +inline QJsonValue readJsonFile(const QString &filename, QJsonParseError *error = 0) { QString filepath = filename; QFile jsonFile(filepath); @@ -82,12 +84,12 @@ QJsonDocument readJsonFile(const QString &filename, QJsonParseError *error = 0) error->error = QJsonParseError::MissingObject; error->offset = 0; } - return QJsonDocument(); + return QJsonValue(); } jsonFile.open(QIODevice::ReadOnly); QByteArray json = jsonFile.readAll(); QJsonDocument doc(QJsonDocument::fromJson(json, error)); - return doc; + return doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()); } inline QProcess *launchJsonDbDaemon(const char *prefix, const QString &socketName, const QStringList &args) |